From: Thomas Arendsen Hein <thomas@intevation.de>
authormpm@selenic.com
Wed, 11 May 2005 14:38:26 -0800
changeset 55 2add70d51441
parent 54 b24731008221
child 56 ad2ea1185f04
From: Thomas Arendsen Hein <thomas@intevation.de> Good. Attached is a patch which also tries to use $EMAIL as the commit user and removed a try/except by using os.environ.get.
mercurial/hg.py
--- a/mercurial/hg.py	Wed May 11 14:37:23 2005 -0800
+++ b/mercurial/hg.py	Wed May 11 14:38:26 2005 -0800
@@ -124,8 +124,9 @@
         return self.extract(self.revision(node))
 
     def add(self, manifest, list, desc, transaction, p1=None, p2=None):
-        try: user = os.environ["HGUSER"]
-        except: user = os.environ["LOGNAME"] + '@' + socket.getfqdn()
+        user = (os.environ.get("HGUSER") or
+                os.environ.get("EMAIL") or
+                os.environ.get("LOGNAME", "unknown") + '@' + socket.getfqdn())
         date = "%d %d" % (time.time(), time.timezone)
         list.sort()
         l = [hex(manifest), user, date] + list + ["", desc]