[PATCH] config: allow 'user' in .hgrc ui section (issue3169)

anatoly techtonik techtonik at gmail.com
Sat Jul 26 06:27:56 UTC 2014


# HG changeset patch
# User anatoly techtonik <techtonik at gmail.com>
# Date 1406356031 -10800
#      Sat Jul 26 09:27:11 2014 +0300
# Node ID 7c1a32d12c36165253c48f947ef7ccf0fe090e7b
# Parent  7142e04b438eab39685e63085503b8af0e42b31e
config: allow 'user' in .hgrc ui section (issue3169)

diff -r 7142e04b438e -r 7c1a32d12c36 mercurial/ui.py
--- a/mercurial/ui.py	Fri Jul 18 19:46:56 2014 -0400
+++ b/mercurial/ui.py	Sat Jul 26 09:27:11 2014 +0300
@@ -438,6 +438,8 @@
         user = os.environ.get("HGUSER")
         if user is None:
             user = self.config("ui", "username")
+            if user is None:
+                user = self.config("ui", "user")
             if user is not None:
                 user = os.path.expandvars(user)
         if user is None:
diff -r 7142e04b438e -r 7c1a32d12c36 tests/test-committer.t
--- a/tests/test-committer.t	Fri Jul 18 19:46:56 2014 -0400
+++ b/tests/test-committer.t	Sat Jul 26 09:27:11 2014 +0300
@@ -63,4 +63,17 @@
   abort: empty username!
   [255]
 
+  $ echo 1234 > asdf
+  $ echo "[ui]" > .hg/hgrc
+  $ echo "user = Foo Bar II <foo2 at bar.com>" >> .hg/hgrc
+  $ hg commit -m commit-1
+  $ hg tip
+  changeset:   5:83fd986938c3
+  tag:         tip
+  user:        Foo Bar II <foo2 at bar.com>
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     commit-1
+  
+  $ rm .hg/hgrc
+
   $ cd ..



More information about the Mercurial-devel mailing list