effectflag: detect when description changed

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

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

Differential Revision: https://phab.mercurial-scm.org/D535
This commit is contained in:
Boris Feld 2017-07-06 14:52:34 +02:00
parent 8d98ff8200
commit 802a17caef
2 changed files with 9 additions and 2 deletions

View File

@ -308,6 +308,8 @@ def foreground(repo, nodes):
# logic around storing and using effect flags
EFFECTFLAGFIELD = "ef1"
DESCCHANGED = 1 << 0 # action changed the description
def geteffectflag(relation):
""" From an obs-marker relation, compute what changed between the
predecessor and the successor.
@ -316,6 +318,11 @@ def geteffectflag(relation):
source = relation[0]
for changectx in relation[1]:
# Check if description has changed
if changectx.description() != source.description():
effects |= DESCCHANGED
return effects
def getobsoleted(repo, tr):

View File

@ -29,7 +29,7 @@ amend touching the description only
check result
$ hg debugobsolete --rev .
471f378eab4c5e25f6c77f785b27c936efb22874 fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'amend', 'user': 'test'}
471f378eab4c5e25f6c77f785b27c936efb22874 fdf9bde5129a28d4548fadd3f62b265cdd3b7a2e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
amend touching the user only
----------------------------
@ -106,7 +106,7 @@ amend with multiple effect (desc and meta)
check result
$ hg debugobsolete --rev .
fad47e5bd78e6aa4db1b5a0a1751bc12563655ff a94e0fd5f1c81d969381a76eb0d37ce499a44fae 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'amend', 'user': 'test'}
fad47e5bd78e6aa4db1b5a0a1751bc12563655ff a94e0fd5f1c81d969381a76eb0d37ce499a44fae 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
rebase not touching the diff
----------------------------