Store in effect flag when the user changed between the predecessor and its
successors.
It can happens with "hg commit --amend -u" or "histedit".
| hg-reviewers |
Store in effect flag when the user changed between the predecessor and its
successors.
It can happens with "hg commit --amend -u" or "histedit".
| Automatic diff as part of commit; lint not applicable. |
| Automatic diff as part of commit; unit tests not applicable. |
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/obsutil.py (5 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 |
| 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 | DESCCHANGED = 1 << 0 # action changed the description | ||||
| USERCHANGED = 1 << 4 # the user changed | |||||
| 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]: | for changectx in relation[1]: | ||||
| # Check if description has changed | # Check if description has changed | ||||
| if changectx.description() != source.description(): | if changectx.description() != source.description(): | ||||
| effects |= DESCCHANGED | effects |= DESCCHANGED | ||||
| # Check if user has changed | |||||
| if changectx.user() != source.user(): | |||||
| effects |= USERCHANGED | |||||
| 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 B0 | $ mkcommit B0 | ||||
| $ hg commit --amend -u "bob <bob@bob.com>" | $ hg commit --amend -u "bob <bob@bob.com>" | ||||
| check result | check result | ||||
| $ hg debugobsolete --rev . | $ hg debugobsolete --rev . | ||||
| ef4a313b1e0ade55718395d80e6b88c5ccd875eb 5485c92d34330dac9d7a63dc07e1e3373835b964 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'amend', 'user': 'test'} | ef4a313b1e0ade55718395d80e6b88c5ccd875eb 5485c92d34330dac9d7a63dc07e1e3373835b964 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '16', 'operation': 'amend', 'user': 'test'} | ||||
| amend touching the date only | amend touching the date only | ||||
| ---------------------------- | ---------------------------- | ||||
| $ mkcommit B1 | $ mkcommit B1 | ||||
| $ hg commit --amend -d "42 0" | $ hg commit --amend -d "42 0" | ||||
| 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': '1', 'operation': 'amend', 'user': 'test'} | fad47e5bd78e6aa4db1b5a0a1751bc12563655ff a94e0fd5f1c81d969381a76eb0d37ce499a44fae 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '17', '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 | ||||