mercurial/ui.py
changeset 3721 98f2507c5551
parent 3678 7e622c9a9707
child 3737 9f5c46c50118
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -336,8 +336,8 @@ class ui(object):
 
         Searched in this order: $HGUSER, [ui] section of hgrcs, $EMAIL
         and stop searching if one of these is set.
-        Abort if no username is found, to force specifying the commit user
-        with line option or repo hgrc.
+        If not found, use ($LOGNAME or $USER or $LNAME or
+        $USERNAME) +"@full.hostname".
         """
         user = os.environ.get("HGUSER")
         if user is None:
@@ -345,12 +345,11 @@ class ui(object):
         if user is None:
             user = os.environ.get("EMAIL")
         if not user:
-            self.status(_("Please choose a commit username to be recorded "
-                          "in the changelog via\ncommand line option "
-                          '(-u "First Last <email@example.com>"), in the\n'
-                          "configuration files (hgrc), or by setting the "
-                          "EMAIL environment variable.\n\n"))
-            raise util.Abort(_("No commit username specified!"))
+            try:
+                user = '%s@%s' % (util.getuser(), socket.getfqdn())
+            except KeyError:
+                raise util.Abort(_("Please specify a username."))
+            self.warn(_("No username found, using '%s' instead\n" % user))
         return user
 
     def shortuser(self, user):