changeset 2448:66f05d5f4769

effectflag: detect meta changes Add the detection of known meta field changes. The known meta fields that we check are: - user - date - branch
author Boris Feld <boris.feld@octobus.net>
date Fri, 19 May 2017 19:48:44 +0200
parents 631ccf45f0bb
children 0b05142117d2
files hgext3rd/evolve/obshistory.py tests/test-evolve-effectflags.t
diffstat 2 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/obshistory.py	Fri May 19 19:43:06 2017 +0200
+++ b/hgext3rd/evolve/obshistory.py	Fri May 19 19:48:44 2017 +0200
@@ -359,6 +359,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...)
 
 def geteffectflag(relation):
     """compute the effect flag by comparing the source and destination"""
@@ -371,6 +372,16 @@
         if changectx.description() != source.description():
             effects |= DESCCHANGED
 
+        # Check if known meta has changed
+        if changectx.user() != source.user():
+            effects |= METACHANGED
+
+        if changectx.date() != source.date():
+            effects |= METACHANGED
+
+        if changectx.branch() != source.branch():
+            effects |= METACHANGED
+
     return effects
 
 @eh.wrapfunction(obsolete, 'createmarkers')
--- a/tests/test-evolve-effectflags.t	Fri May 19 19:43:06 2017 +0200
+++ b/tests/test-evolve-effectflags.t	Fri May 19 19:48:44 2017 +0200
@@ -35,3 +35,20 @@
   x  471f378eab4c (1) A0
        rewritten by test (*) as fdf9bde5129a (glob)
   
+
+amend touching the metadata only
+--------------------------------
+
+  $ mkcommit B0
+  $ hg amend -u "bob <bob@bob.com>"
+
+check result
+
+  $ hg debugobsolete --rev .
+  ef4a313b1e0ade55718395d80e6b88c5ccd875eb 5485c92d34330dac9d7a63dc07e1e3373835b964 0 (*) {'ef1': '2', 'user': 'test'} (glob)
+  $ hg obslog .
+  @  5485c92d3433 (4) B0
+  |
+  x  ef4a313b1e0a (3) B0
+       rewritten by test (*) as 5485c92d3433 (glob)
+