diff mercurial/commands.py @ 9734:36c388a1aa51

commands: call ui.username carefully in debuginstall After c63c336ee2f7, 'hg debuginstall' would abort halfway through if no username was set. We now catch and display the exception instead.
author Martin Geisler <mg@lazybytes.net>
date Sat, 07 Nov 2009 01:46:27 +0100
parents 3f522d2fa633
children 2ebe679fec21
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Nov 07 00:13:05 2009 +0100
+++ b/mercurial/commands.py	Sat Nov 07 01:46:27 2009 +0100
@@ -1029,15 +1029,12 @@
 
     # check username
     ui.status(_("Checking username...\n"))
-    user = os.environ.get("HGUSER")
-    if user is None:
-        user = ui.config("ui", "username")
-    if user is None:
-        user = os.environ.get("EMAIL")
-    if not user:
-        ui.warn(" ")
-        ui.username()
+    try:
+        user = ui.username()
+    except util.Abort, e:
+        ui.write(" %s\n" % e)
         ui.write(_(" (specify a username in your .hgrc file)\n"))
+        problems += 1
 
     if not problems:
         ui.status(_("No problems detected\n"))