--- a/mercurial/ui.py Tue Nov 28 19:11:46 2006 +0100
+++ b/mercurial/ui.py Tue Nov 28 21:16:05 2006 +0100
@@ -336,8 +336,8 @@
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 @@
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):