Hello,

When "hg ci" is run without the "-u" option it should
take the contents of /etc/mailname (if it exists) as
the domain name part of the user address.

EG It should use r...@coker.com.au when I run it not
r...@server.coker.com.au.

Patch attached. But recent Mercurial versions will by
default fail for interactive commits if a username
isn't configured, so this change may not be that useful.

Also it would be nice if an environment variable  could
be used for this so I could set it in .bashrc and not
have to worry about a -u option.

This is already supported: just set HGUSER (see "hg help
environment" for details). Alternatively you may set
your username in ~/.hgrc, like this:

[ui]
username = r...@coker.com.au

Regards,
Wagner

# HG changeset patch
# User Wagner Bruna <wbr...@yahoo.com>
# Date 1266003625 7200
# Node ID ea28d910ae620b3358fad0967a1a93f8c5b46434
# Parent  41d0ed2c79df052bf2076c05d639ac95b58dbf10
bug#448655: try /etc/mailname for setting the username

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -186,7 +186,11 @@
             user = self.prompt(_("enter a commit username:"), default=None)
         if user is None and not self.interactive():
             try:
-                user = '%...@%s' % (util.getuser(), socket.getfqdn())
+                try:
+                    mailname = open('/etc/mailname').read().strip()
+                    user = '%...@%s' % (util.getuser(), mailname)
+                except IOError:
+                    user = '%...@%s' % (util.getuser(), socket.getfqdn())
                 self.warn(_("No username found, using '%s' instead\n") % user)
             except KeyError:
                 pass



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to