Store in effect flag when the branch changed between the predecessor and
its successors.
It can happens with "hg branch" + "hg commit --amend", "hg branch" + "hg
amend" or "histedit".
| hg-reviewers |
Store in effect flag when the branch changed between the predecessor and
its successors.
It can happens with "hg branch" + "hg commit --amend", "hg branch" + "hg
amend" 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 |
| 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 | USERCHANGED = 1 << 4 # the user changed | ||||
| DATECHANGED = 1 << 5 # the date changed | DATECHANGED = 1 << 5 # the date changed | ||||
| BRANCHCHANGED = 1 << 6 # the branch 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 | # Check if user has changed | ||||
| if changectx.user() != source.user(): | if changectx.user() != source.user(): | ||||
| effects |= USERCHANGED | effects |= USERCHANGED | ||||
| # Check if date has changed | # Check if date has changed | ||||
| if changectx.date() != source.date(): | if changectx.date() != source.date(): | ||||
| effects |= DATECHANGED | effects |= DATECHANGED | ||||
| # Check if branch has changed | |||||
| if changectx.branch() != source.branch(): | |||||
| effects |= BRANCHCHANGED | |||||
| 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 | ||||
| $ hg branch my-branch | $ hg branch my-branch | ||||
| marked working directory as branch my-branch | marked working directory as branch my-branch | ||||
| (branches are permanent and global, did you want a bookmark?) | (branches are permanent and global, did you want a bookmark?) | ||||
| $ hg commit --amend | $ hg commit --amend | ||||
| check result | check result | ||||
| $ hg debugobsolete --rev . | $ hg debugobsolete --rev . | ||||
| bd3db8264ceebf1966319f5df3be7aac6acd1a8e 14a01456e0574f0e0a0b15b2345486a6364a8d79 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'amend', 'user': 'test'} | bd3db8264ceebf1966319f5df3be7aac6acd1a8e 14a01456e0574f0e0a0b15b2345486a6364a8d79 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '64', 'operation': 'amend', 'user': 'test'} | ||||
| $ hg up default | $ hg up default | ||||
| 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | ||||
| rebase (parents change) | rebase (parents change) | ||||
| ----------------------- | ----------------------- | ||||
| $ mkcommit C0 | $ mkcommit C0 | ||||
| $ 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': '49', 'operation': 'amend', 'user': 'test'} | fad47e5bd78e6aa4db1b5a0a1751bc12563655ff a94e0fd5f1c81d969381a76eb0d37ce499a44fae 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '113', '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 | ||||