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

login
register
mail settings
Submitter anatoly techtonik
Date July 26, 2014, 10:29 p.m.
Message ID <d4153d7e6a1c783001b8.1406413749@BlackBox>
Download mbox | patch
Permalink /patch/5204/
State Accepted
Commit 6dfb78f18bdba03067c7060cbe5b4ca2e757dde9
Headers show

Comments

anatoly techtonik - July 26, 2014, 10:29 p.m.
# HG changeset patch
# User anatoly techtonik <techtonik@gmail.com>
# Date 1406356031 -10800
#      Sat Jul 26 09:27:11 2014 +0300
# Node ID d4153d7e6a1c783001b8d08dfcce169784a8a0cf
# Parent  7142e04b438eab39685e63085503b8af0e42b31e
config: allow 'user' in .hgrc ui section (issue3169)
Matt Mackall - July 30, 2014, 9:03 p.m.
On Sun, 2014-07-27 at 01:29 +0300, anatoly techtonik wrote:
> # HG changeset patch
> # User anatoly techtonik <techtonik@gmail.com>
> # Date 1406356031 -10800
> #      Sat Jul 26 09:27:11 2014 +0300
> # Node ID d4153d7e6a1c783001b8d08dfcce169784a8a0cf
> # Parent  7142e04b438eab39685e63085503b8af0e42b31e
> config: allow 'user' in .hgrc ui section (issue3169)

Queued for stable, thanks.

Patch

diff -r 7142e04b438e -r d4153d7e6a1c 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
@@ -437,7 +437,7 @@ 
         """
         user = os.environ.get("HGUSER")
         if user is None:
-            user = self.config("ui", "username")
+            user = self.config("ui", ["username", "user"])
             if user is not None:
                 user = os.path.expandvars(user)
         if user is None:
diff -r 7142e04b438e -r d4153d7e6a1c 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@bar.com>" >> .hg/hgrc
+  $ hg commit -m commit-1
+  $ hg tip
+  changeset:   5:83fd986938c3
+  tag:         tip
+  user:        Foo Bar II <foo2@bar.com>
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     commit-1
+  
+  $ rm .hg/hgrc
+
   $ cd ..