mercurial/ui.py
changeset 6862 7192876ac329
parent 6762 f67d1468ac50
child 7320 8dca507e56ce
--- a/mercurial/ui.py	Sat Aug 02 23:45:10 2008 +0200
+++ b/mercurial/ui.py	Wed Aug 06 15:10:05 2008 +0200
@@ -331,14 +331,16 @@
 
         Searched in this order: $HGUSER, [ui] section of hgrcs, $EMAIL
         and stop searching if one of these is set.
-        If not found, use ($LOGNAME or $USER or $LNAME or
-        $USERNAME) +"@full.hostname".
+        If not found and ui.askusername is True, ask the user, else use
+        ($LOGNAME or $USER or $LNAME or $USERNAME) + "@full.hostname".
         """
         user = os.environ.get("HGUSER")
         if user is None:
             user = self.config("ui", "username")
         if user is None:
             user = os.environ.get("EMAIL")
+        if user is None and self.configbool("ui", "askusername"):
+            user = self.prompt(_("Enter a commit username:"), default=None)
         if user is None:
             try:
                 user = '%s@%s' % (util.getuser(), socket.getfqdn())