changeset 2453:ad08aedf25ac

obshistory: display informations from the obs marker effect flag Leverage the effect flag to actually show what change for each obsmarker in the obslog command. (first basic version).
author Boris Feld <boris.feld@octobus.net>
date Fri, 19 May 2017 20:21:10 +0200
parents d3844cdc202a
children 400dbec0849c
files hgext3rd/evolve/obshistory.py tests/test-evolve-effectflags.t
diffstat 2 files changed, 31 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/obshistory.py	Fri May 19 20:43:16 2017 +0200
+++ b/hgext3rd/evolve/obshistory.py	Fri May 19 20:21:10 2017 +0200
@@ -23,6 +23,12 @@
     exthelper,
 )
 
+# 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
+DIFFCHANGED = 1 << 3 # action change diff introduced by the changeset
+
 eh = exthelper.exthelper()
 
 @eh.command(
@@ -338,6 +344,25 @@
 
     fm.write('debugobshistory.verb', '%s', verb,
              label="evolve.verb")
+
+    effectflag = metadata.get('ef1')
+    if effectflag:
+        effect = []
+        effectflag = int(effectflag)
+
+        if effectflag & DESCCHANGED:
+            effect.append('description')
+        if effectflag & METACHANGED:
+            effect.append('meta')
+        if effectflag & PARENTCHANGED:
+            effect.append('parent')
+        if effectflag & DIFFCHANGED:
+            effect.append('content')
+
+        if effect:
+            fmteffect = fm.formatlist(effect, 'debugobshistory.effect', sep=', ')
+            fm.write('debugobshistory.effect', '(%s)', fmteffect)
+
     fm.plain(' by ')
 
     fm.write('debugobshistory.marker_user', '%s', metadata['user'],
@@ -357,12 +382,6 @@
 
     fm.plain("\n")
 
-# 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
-DIFFCHANGED = 1 << 3 # action change diff introduced by the changeset
-
 def geteffectflag(relation):
     """compute the effect flag by comparing the source and destination"""
     effects = 0
--- a/tests/test-evolve-effectflags.t	Fri May 19 20:43:16 2017 +0200
+++ b/tests/test-evolve-effectflags.t	Fri May 19 20:21:10 2017 +0200
@@ -34,7 +34,7 @@
   @  fdf9bde5129a (2) A1
   |
   x  471f378eab4c (1) A0
-       rewritten by test (*) as fdf9bde5129a (glob)
+       rewritten(description) by test (*) as fdf9bde5129a (glob)
   
 
 amend touching the metadata only
@@ -51,8 +51,9 @@
   @  5485c92d3433 (4) B0
   |
   x  ef4a313b1e0a (3) B0
-       rewritten by test (*) as 5485c92d3433 (glob)
+       rewritten(meta) by test (*) as 5485c92d3433 (glob)
   
+
 rebase (parents change)
 -----------------------
 
@@ -69,7 +70,7 @@
   @  131ac3eecd92 (7) D0
   |
   x  2ee0a31bd600 (6) D0
-       rewritten by test (*) as 131ac3eecd92 (glob)
+       rewritten(parent) by test (*) as 131ac3eecd92 (glob)
   
 
 amend touching the diff
@@ -88,7 +89,7 @@
   @  bed7e49faeb8 (10) E0
   |
   x  f75604747b4f (8) E0
-       rewritten by test (*) as bed7e49faeb8 (glob)
+       rewritten(content) by test (*) as bed7e49faeb8 (glob)
   
 
 amend with multiple effect (desc and meta)
@@ -105,5 +106,5 @@
   @  7d0186621c5b (12) F1
   |
   x  713ccc39944e (11) F0
-       rewritten by test (*) as 7d0186621c5b (glob)
+       rewritten(description, meta) by test (*) as 7d0186621c5b (glob)