Patchwork [01,of,11] obsolete: add a devel.user.obsmarker

login
register
mail settings
Submitter Boris Feld
Date Oct. 9, 2017, 6:40 p.m.
Message ID <fe4b0b77c2456419342c.1507574443@FB>
Download mbox | patch
Permalink /patch/24667/
State Superseded
Headers show

Comments

Boris Feld - Oct. 9, 2017, 6:40 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1507299324 -7200
#      Fri Oct 06 16:15:24 2017 +0200
# Node ID fe4b0b77c2456419342cc50b4c697c7518be8d6c
# Parent  8cef8f7d51d0f1e99889779ec1320d5c9c3b91de
# EXP-Topic obsfatekeyword
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r fe4b0b77c245
obsolete: add a devel.user.obsmarker

In tests, we often want to use a different username in obs-markers without
changing the default user. Add a 'devel.user.obsmarker'.

Patch

diff -r 8cef8f7d51d0 -r fe4b0b77c245 mercurial/configitems.py
--- a/mercurial/configitems.py	Thu Oct 05 20:41:50 2017 -0700
+++ b/mercurial/configitems.py	Fri Oct 06 16:15:24 2017 +0200
@@ -146,6 +146,9 @@ 
 coreconfigitem('devel', 'strip-obsmarkers',
     default=True,
 )
+coreconfigitem('devel', 'user.obsmarker',
+    default=None,
+)
 coreconfigitem('email', 'charsets',
     default=list,
 )
diff -r 8cef8f7d51d0 -r fe4b0b77c245 mercurial/obsolete.py
--- a/mercurial/obsolete.py	Thu Oct 05 20:41:50 2017 -0700
+++ b/mercurial/obsolete.py	Fri Oct 06 16:15:24 2017 +0200
@@ -1035,7 +1035,11 @@ 
     if metadata is None:
         metadata = {}
     if 'user' not in metadata:
-        metadata['user'] = repo.ui.username()
+        develuser = repo.ui.config('devel', 'user.obsmarker')
+        if develuser:
+            metadata['user'] = develuser
+        else:
+            metadata['user'] = repo.ui.username()
 
     # Operation metadata handling
     useoperation = repo.ui.configbool('experimental',
diff -r 8cef8f7d51d0 -r fe4b0b77c245 tests/test-obsmarker-template.t
--- a/tests/test-obsmarker-template.t	Thu Oct 05 20:41:50 2017 -0700
+++ b/tests/test-obsmarker-template.t	Fri Oct 06 16:15:24 2017 +0200
@@ -42,8 +42,8 @@ 
   $ mkcommit ROOT
   $ mkcommit A0
   $ echo 42 >> A0
-  $ HGUSER=test1 hg commit --amend -m "A1" --config devel.default-date="1234567890 0"
-  $ HGUSER=test2 hg commit --amend -m "A2" --config devel.default-date="987654321 0"
+  $ hg commit --amend -m "A1" --config devel.default-date="1234567890 0" --config devel.user.obsmarker=test1
+  $ hg commit --amend -m "A2" --config devel.default-date="987654321 0" --config devel.user.obsmarker=test2
 
   $ hg log --hidden -G
   @  changeset:   3:d004c8f274b9