effectflag: split effect flag meta
Split effect flag meta into 3 separate flags:
- USERCHANGED
- DATECHANGED
- BRANCHCHANGED
Also display them separately for the moment, they could be grouped back
together if we want later.
--- a/hgext3rd/evolve/obshistory.py Fri May 26 21:31:07 2017 +0200
+++ b/hgext3rd/evolve/obshistory.py Fri May 26 18:27:59 2017 +0200
@@ -367,6 +367,12 @@
effect.append('description')
if effectflag & METACHANGED:
effect.append('meta')
+ if effectflag & USERCHANGED:
+ effect.append('user')
+ if effectflag & DATECHANGED:
+ effect.append('date')
+ if effectflag & BRANCHCHANGED:
+ effect.append('branch')
if effectflag & PARENTCHANGED:
effect.append('parent')
if effectflag & DIFFCHANGED:
@@ -397,9 +403,12 @@
# 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...)
+METACHANGED = 1 << 1 # action change the meta (user, date, branch, etc...) OLD
PARENTCHANGED = 1 << 2 # action change the parent
DIFFCHANGED = 1 << 3 # action change diff introduced by the changeset
+USERCHANGED = 1 << 4 # the user changed
+DATECHANGED = 1 << 5 # the date changed
+BRANCHCHANGED = 1 << 6 # the branch changed
def geteffectflag(relation):
"""compute the effect flag by comparing the source and destination"""
@@ -413,10 +422,14 @@
effects |= DESCCHANGED
# Check if known meta has changed
- if (changectx.user() != source.user()
- or changectx.date() != source.date()
- or changectx.branch() != source.branch()):
- effects |= METACHANGED
+ if changectx.user() != source.user():
+ effects |= USERCHANGED
+
+ if changectx.date() != source.date():
+ effects |= DATECHANGED
+
+ if changectx.branch() != source.branch():
+ effects |= BRANCHCHANGED
# Check if at least one of the parent has changes
if changectx.parents() != source.parents():
--- a/tests/test-evolve-effectflags.t Fri May 26 21:31:07 2017 +0200
+++ b/tests/test-evolve-effectflags.t Fri May 26 18:27:59 2017 +0200
@@ -37,8 +37,8 @@
rewritten(description) by test (*) as fdf9bde5129a (glob)
-amend touching the metadata only
---------------------------------
+amend touching the user only
+----------------------------
$ mkcommit B0
$ hg amend -u "bob <bob@bob.com>"
@@ -46,31 +46,72 @@
check result
$ hg debugobsolete --rev .
- ef4a313b1e0ade55718395d80e6b88c5ccd875eb 5485c92d34330dac9d7a63dc07e1e3373835b964 0 (*) {'ef1': '2', 'user': 'test'} (glob)
+ ef4a313b1e0ade55718395d80e6b88c5ccd875eb 5485c92d34330dac9d7a63dc07e1e3373835b964 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '16', 'user': 'test'}
$ hg obslog .
@ 5485c92d3433 (4) B0
|
x ef4a313b1e0a (3) B0
- rewritten(meta) by test (*) as 5485c92d3433 (glob)
+ rewritten(user) by test (Thu Jan 01 00:00:00 1970 +0000) as 5485c92d3433
+
+
+amend touching the date only
+----------------------------
+
+ $ mkcommit B1
+ $ hg amend -d "42 0"
+
+check result
+
+ $ hg debugobsolete --rev .
+ 2ef0680ff45038ac28c9f1ff3644341f54487280 4dd84345082e9e5291c2e6b3f335bbf8bf389378 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '32', 'user': 'test'}
+ $ hg obslog .
+ @ 4dd84345082e (6) B1
+ |
+ x 2ef0680ff450 (5) B1
+ rewritten(date) by test (Thu Jan 01 00:00:00 1970 +0000) as 4dd84345082e
+amend touching the branch only
+----------------------------
+
+ $ mkcommit B2
+ $ hg branch my-branch
+ marked working directory as branch my-branch
+ (branches are permanent and global, did you want a bookmark?)
+ $ hg amend
+
+check result
+
+ $ 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': '64', 'user': 'test'}
+ $ hg obslog .
+ @ 14a01456e057 (9) B2
+ |
+ x bd3db8264cee (7) B2
+ rewritten(branch) by test (Thu Jan 01 00:00:00 1970 +0000) as 14a01456e057
+
+
+ $ hg up default
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
rebase (parents change)
-----------------------
$ mkcommit C0
$ mkcommit D0
$ hg rebase -r . -d 'desc(B0)'
- rebasing 6:2ee0a31bd600 "D0" (tip)
+ rebasing 11:c85eff83a034 "D0" (tip)
check result
$ hg debugobsolete --rev .
- 2ee0a31bd600ca999a5e6e69bfdfde3f9c78a6f9 131ac3eecd92fb2dfd2fc59bb5e0b8efbe9e9201 0 (*) {'ef1': '4', 'user': 'test'} (glob)
+ c85eff83a0340efd9da52b806a94c350222f3371 da86aa2f19a30d6686b15cae15c7b6c908ec9699 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'user': 'test'}
$ hg obslog .
- @ 131ac3eecd92 (7) D0
+ @ da86aa2f19a3 (12) D0
|
- x 2ee0a31bd600 (6) D0
- rewritten(parent) by test (*) as 131ac3eecd92 (glob)
+ x c85eff83a034 (11) D0
+ rewritten(parent) by test (Thu Jan 01 00:00:00 1970 +0000) as da86aa2f19a3
amend touching the diff
@@ -83,28 +124,31 @@
check result
$ hg debugobsolete --rev .
- 5734caf1004261ffc2ed05763b82bf9d75ba3788 0 {f75604747b4fd2dfebe7f48c6e629aea15e3b237} (*) {'ef1': '0', 'user': 'test'} (glob)
- f75604747b4fd2dfebe7f48c6e629aea15e3b237 bed7e49faeb8ae06649b547a755d50f5bb0be220 0 (*) {'ef1': '8', 'user': 'test'} (glob)
+ d6f4d8b8d3c8cde990f13915bced7f92ce1cc54f 0 {ebfe0333e0d96f68a917afd97c0a0af87f1c3b5f} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'user': 'test'}
+ ebfe0333e0d96f68a917afd97c0a0af87f1c3b5f 75781fdbdbf58a987516b00c980bccda1e9ae588 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'user': 'test'}
$ hg obslog .
- @ bed7e49faeb8 (10) E0
+ @ 75781fdbdbf5 (15) E0
|
- x f75604747b4f (8) E0
- rewritten(content) by test (*) as bed7e49faeb8 (glob)
+ x ebfe0333e0d9 (13) E0
+ rewritten(content) by test (Thu Jan 01 00:00:00 1970 +0000) as 75781fdbdbf5
amend with multiple effect (desc and meta)
-------------------------------------------
$ mkcommit F0
- $ hg amend -m F1 -u "bob <bob@bob.com>"
+ $ hg branch my-other-branch
+ marked working directory as branch my-other-branch
+ $ hg amend -m F1 -u "bob <bob@bob.com>" -d "42 0"
check result
$ hg debugobsolete --rev .
- 713ccc39944e10bd35b7f6eaed3eef0eab60e50b 7d0186621c5ba1b0f7c5c99668d43273cb44c2fe 0 (*) {'ef1': '3', 'user': 'test'} (glob)
+ 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': '113', 'user': 'test'}
$ hg obslog .
- @ 7d0186621c5b (12) F1
+ @ a94e0fd5f1c8 (18) F1
|
- x 713ccc39944e (11) F0
- rewritten(description, meta) by test (*) as 7d0186621c5b (glob)
+ x fad47e5bd78e (16) F0
+ rewritten(description, user, date, branch) by test (Thu Jan 01 00:00:00 1970 +0000) as a94e0fd5f1c8