[PATCH 05 of 10] effectflag: detect when user changed

Boris Feld boris.feld at octobus.net
Fri Jul 7 08:38:34 EDT 2017


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1499345628 -7200
#      Thu Jul 06 14:53:48 2017 +0200
# Node ID 765f9c129b4e67e92f52075e00bfb4f3c24094f6
# Parent  a00ff3d815d246d40a0add309119e98373f5d9f5
# EXP-Topic effectflag
effectflag: detect when user changed

Store in effect flag when the description changed between the predecessor and
its successors.

It can happens with "hg commit --amend -u" or "histedit".

diff -r a00ff3d815d2 -r 765f9c129b4e mercurial/obsutil.py
--- a/mercurial/obsutil.py	Thu Jul 06 14:52:34 2017 +0200
+++ b/mercurial/obsutil.py	Thu Jul 06 14:53:48 2017 +0200
@@ -538,6 +538,7 @@
 
 # logic around storing and using effect flags
 DESCCHANGED = 1 << 0 # action changed the description
+USERCHANGED = 1 << 4 # the user changed
 
 def geteffectflag(relation):
     """ From an obs-marker relation, compute what changed between the
@@ -552,4 +553,8 @@
         if changectx.description() != source.description():
             effects |= DESCCHANGED
 
+        # Check if user has changed
+        if changectx.user() != source.user():
+            effects |= USERCHANGED
+
     return effects
diff -r a00ff3d815d2 -r 765f9c129b4e tests/test-obsmarkers-effectflag.t
--- a/tests/test-obsmarkers-effectflag.t	Thu Jul 06 14:52:34 2017 +0200
+++ b/tests/test-obsmarkers-effectflag.t	Thu Jul 06 14:53:48 2017 +0200
@@ -40,7 +40,7 @@
 check result
 
   $ hg debugobsolete --rev .
-  ef4a313b1e0ade55718395d80e6b88c5ccd875eb 5485c92d34330dac9d7a63dc07e1e3373835b964 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'user': 'test'}
+  ef4a313b1e0ade55718395d80e6b88c5ccd875eb 5485c92d34330dac9d7a63dc07e1e3373835b964 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '16', 'user': 'test'}
 
 amend touching the date only
 ----------------------------
@@ -109,7 +109,7 @@
 
   $ hg debugobsolete --rev .
   3b12912003b4e7aa6df6cded86255006c3c29d27 0 {fad47e5bd78e6aa4db1b5a0a1751bc12563655ff} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'user': 'test'}
-  fad47e5bd78e6aa4db1b5a0a1751bc12563655ff a94e0fd5f1c81d969381a76eb0d37ce499a44fae 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'user': 'test'}
+  fad47e5bd78e6aa4db1b5a0a1751bc12563655ff a94e0fd5f1c81d969381a76eb0d37ce499a44fae 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '17', 'user': 'test'}
 
 rebase not touching the diff
 ----------------------------


More information about the Mercurial-devel mailing list