[PATCH 07 of 10] effectflag: detect when branch changed

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


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1499345712 -7200
#      Thu Jul 06 14:55:12 2017 +0200
# Node ID 194f5c17a9d460ac0376c9d5dd215c8d6222b3ed
# Parent  7bf0e2d03ccfd013693ecef6aff79804ed1b97d6
# EXP-Topic effectflag
effectflag: detect when branch changed

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

It can happens with "hg branch" + "hg commit --amend", "hg amend" or
"histedit".

diff -r 7bf0e2d03ccf -r 194f5c17a9d4 mercurial/obsutil.py
--- a/mercurial/obsutil.py	Thu Jul 06 14:54:22 2017 +0200
+++ b/mercurial/obsutil.py	Thu Jul 06 14:55:12 2017 +0200
@@ -540,6 +540,7 @@
 DESCCHANGED = 1 << 0 # action changed the description
 USERCHANGED = 1 << 4 # the user changed
 DATECHANGED = 1 << 5 # the date changed
+BRANCHCHANGED = 1 << 6 # the branch changed
 
 def geteffectflag(relation):
     """ From an obs-marker relation, compute what changed between the
@@ -562,4 +563,8 @@
         if changectx.date() != source.date():
             effects |= DATECHANGED
 
+        # Check if branch has changed
+        if changectx.branch() != source.branch():
+            effects |= BRANCHCHANGED
+
     return effects
diff -r 7bf0e2d03ccf -r 194f5c17a9d4 tests/test-obsmarkers-effectflag.t
--- a/tests/test-obsmarkers-effectflag.t	Thu Jul 06 14:54:22 2017 +0200
+++ b/tests/test-obsmarkers-effectflag.t	Thu Jul 06 14:55:12 2017 +0200
@@ -66,7 +66,7 @@
 
   $ hg debugobsolete --rev .
   4d1430a201c1ffbd8465dec75edd4a691a2d97ec 0 {bd3db8264ceebf1966319f5df3be7aac6acd1a8e} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'user': 'test'}
-  bd3db8264ceebf1966319f5df3be7aac6acd1a8e 14a01456e0574f0e0a0b15b2345486a6364a8d79 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'user': 'test'}
+  bd3db8264ceebf1966319f5df3be7aac6acd1a8e 14a01456e0574f0e0a0b15b2345486a6364a8d79 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '64', 'user': 'test'}
 
   $ hg up default
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -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': '49', 'user': 'test'}
+  fad47e5bd78e6aa4db1b5a0a1751bc12563655ff a94e0fd5f1c81d969381a76eb0d37ce499a44fae 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '113', 'user': 'test'}
 
 rebase not touching the diff
 ----------------------------


More information about the Mercurial-devel mailing list