effectflag: detect parent change
authorBoris Feld <boris.feld@octobus.net>
Fri, 19 May 2017 19:52:57 +0200
changeset 2449 0b05142117d2
parent 2448 66f05d5f4769
child 2450 98613938d098
effectflag: detect parent change Add the detection of parent changes.
hgext3rd/evolve/obshistory.py
tests/test-evolve-effectflags.t
--- a/hgext3rd/evolve/obshistory.py	Fri May 19 19:48:44 2017 +0200
+++ b/hgext3rd/evolve/obshistory.py	Fri May 19 19:52:57 2017 +0200
@@ -360,6 +360,7 @@
 # logic around storing and using effect flags
 DESCCHANGED = 1 << 0 # action changed the description
 METACHANGED = 1 << 1 # action change the meta (user, date, branch, etc...)
+PARENTCHANGED = 1 << 2 # action change the parent
 
 def geteffectflag(relation):
     """compute the effect flag by comparing the source and destination"""
@@ -382,6 +383,10 @@
         if changectx.branch() != source.branch():
             effects |= METACHANGED
 
+        # Check if at least one of the parent has changes
+        if changectx.parents() != source.parents():
+            effects |= PARENTCHANGED
+
     return effects
 
 @eh.wrapfunction(obsolete, 'createmarkers')
--- a/tests/test-evolve-effectflags.t	Fri May 19 19:48:44 2017 +0200
+++ b/tests/test-evolve-effectflags.t	Fri May 19 19:52:57 2017 +0200
@@ -11,6 +11,7 @@
   > publish=False
   > [extensions]
   > evolve =
+  > rebase =
   > [experimental]
   > evolution.effect-flags = 1
   > EOF
@@ -52,3 +53,21 @@
   x  ef4a313b1e0a (3) B0
        rewritten by test (*) as 5485c92d3433 (glob)
   
+rebase (parents change)
+-----------------------
+
+  $ mkcommit C0
+  $ mkcommit D0
+  $ hg rebase -r . -d 'desc(B0)'
+  rebasing 6:2ee0a31bd600 "D0" (tip)
+
+check result
+
+  $ hg debugobsolete --rev .
+  2ee0a31bd600ca999a5e6e69bfdfde3f9c78a6f9 131ac3eecd92fb2dfd2fc59bb5e0b8efbe9e9201 0 (*) {'ef1': '4', 'user': 'test'} (glob)
+  $ hg obslog .
+  @  131ac3eecd92 (7) D0
+  |
+  x  2ee0a31bd600 (6) D0
+       rewritten by test (*) as 131ac3eecd92 (glob)
+