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".
hg-reviewers |
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".
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/obsutil.py (7 lines) | |||
M | tests/test-obsmarkers-effectflag.t (4 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | lothiraldan | ||
Abandoned | durin42 | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan |
succs.update(allsuccessors(repo.obsstore, mutable)) | succs.update(allsuccessors(repo.obsstore, mutable)) | ||||
known = (n for n in succs if n in nm) | known = (n for n in succs if n in nm) | ||||
foreground = set(repo.set('%ln::', known)) | foreground = set(repo.set('%ln::', known)) | ||||
return set(c.node() for c in foreground) | return set(c.node() for c in foreground) | ||||
# logic around storing and using effect flags | # logic around storing and using effect flags | ||||
EFFECTFLAGFIELD = "ef1" | EFFECTFLAGFIELD = "ef1" | ||||
DESCCHANGED = 1 << 0 # action changed the description | |||||
def geteffectflag(relation): | def geteffectflag(relation): | ||||
""" From an obs-marker relation, compute what changed between the | """ From an obs-marker relation, compute what changed between the | ||||
predecessor and the successor. | predecessor and the successor. | ||||
""" | """ | ||||
effects = 0 | effects = 0 | ||||
source = relation[0] | source = relation[0] | ||||
for changectx in relation[1]: | |||||
# Check if description has changed | |||||
if changectx.description() != source.description(): | |||||
effects |= DESCCHANGED | |||||
return effects | return effects | ||||
def getobsoleted(repo, tr): | def getobsoleted(repo, tr): | ||||
"""return the set of pre-existing revisions obsoleted by a transaction""" | """return the set of pre-existing revisions obsoleted by a transaction""" | ||||
torev = repo.unfiltered().changelog.nodemap.get | torev = repo.unfiltered().changelog.nodemap.get | ||||
phase = repo._phasecache.phase | phase = repo._phasecache.phase | ||||
succsmarkers = repo.obsstore.successors.get | succsmarkers = repo.obsstore.successors.get | ||||
public = phases.public | public = phases.public |
----------------------------------- | ----------------------------------- | ||||
$ mkcommit A0 | $ mkcommit A0 | ||||
$ hg commit --amend -m "A1" | $ hg commit --amend -m "A1" | ||||
check result | check result | ||||
$ hg debugobsolete --rev . | $ 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 | amend touching the user only | ||||
---------------------------- | ---------------------------- | ||||
$ mkcommit B0 | $ mkcommit B0 | ||||
$ hg commit --amend -u "bob <bob@bob.com>" | $ hg commit --amend -u "bob <bob@bob.com>" | ||||
check result | check result | ||||
$ mkcommit F0 | $ mkcommit F0 | ||||
$ hg branch my-other-branch | $ hg branch my-other-branch | ||||
marked working directory as branch my-other-branch | marked working directory as branch my-other-branch | ||||
$ hg commit --amend -m F1 -u "bob <bob@bob.com>" -d "42 0" | $ hg commit --amend -m F1 -u "bob <bob@bob.com>" -d "42 0" | ||||
check result | check result | ||||
$ hg debugobsolete --rev . | $ 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 | rebase not touching the diff | ||||
---------------------------- | ---------------------------- | ||||
$ cat << EOF > H0 | $ cat << EOF > H0 | ||||
> 0 | > 0 | ||||
> 1 | > 1 | ||||
> 2 | > 2 |