diff mercurial/ui.py @ 4044:78a0dd93db0b

Abort on empty username so specifying a username can be forced. This behaviour was introduced by c3345b0f2fcd and broken by 98f2507c5551. Added test for this.
author Thomas Arendsen Hein <thomas@intevation.de>
date Wed, 24 Jan 2007 23:04:51 +0100
parents f82b3f915605
children 1bd6868b0b11 76d541c6f3c0
line wrap: on
line diff
--- a/mercurial/ui.py	Sun Jan 14 19:10:35 2007 +0100
+++ b/mercurial/ui.py	Wed Jan 24 23:04:51 2007 +0100
@@ -345,12 +345,14 @@
             user = self.config("ui", "username")
         if user is None:
             user = os.environ.get("EMAIL")
-        if not user:
+        if user is None:
             try:
                 user = '%s@%s' % (util.getuser(), socket.getfqdn())
+                self.warn(_("No username found, using '%s' instead\n") % user)
             except KeyError:
-                raise util.Abort(_("Please specify a username."))
-            self.warn(_("No username found, using '%s' instead\n") % user)
+                pass
+        if not user:
+            raise util.Abort(_("Please specify a username."))
         return user
 
     def shortuser(self, user):