Store in effect flag when the parents changed between the predecessor and
its successors.
It can happens with "hg rebase" or "hg grab".
| hg-reviewers |
Store in effect flag when the parents changed between the predecessor and
its successors.
It can happens with "hg rebase" or "hg grab".
| Lint Skipped |
| Unit Tests Skipped |
| 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 | ||||
| PARENTCHANGED = 1 << 2 # action change the parent | |||||
| 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 | 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. | ||||
| """ | """ | ||||
| # 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 | # Check if branch has changed | ||||
| if changectx.branch() != source.branch(): | if changectx.branch() != source.branch(): | ||||
| effects |= BRANCHCHANGED | effects |= BRANCHCHANGED | ||||
| # Check if at least one of the parent has changed | |||||
| if changectx.parents() != source.parents(): | |||||
| effects |= PARENTCHANGED | |||||
| 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 C0 | $ mkcommit C0 | ||||
| $ mkcommit D0 | $ mkcommit D0 | ||||
| $ hg rebase -r . -d 'desc(B0)' | $ hg rebase -r . -d 'desc(B0)' | ||||
| rebasing 11:c85eff83a034 "D0" (tip) | rebasing 11:c85eff83a034 "D0" (tip) | ||||
| check result | check result | ||||
| $ hg debugobsolete --rev . | $ hg debugobsolete --rev . | ||||
| c85eff83a0340efd9da52b806a94c350222f3371 da86aa2f19a30d6686b15cae15c7b6c908ec9699 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'user': 'test'} | c85eff83a0340efd9da52b806a94c350222f3371 da86aa2f19a30d6686b15cae15c7b6c908ec9699 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'user': 'test'} | ||||
| amend touching the diff | amend touching the diff | ||||
| ----------------------- | ----------------------- | ||||
| $ mkcommit E0 | $ mkcommit E0 | ||||
| $ echo 42 >> E0 | $ echo 42 >> E0 | ||||
| $ hg commit --amend | $ hg commit --amend | ||||
| > 10 | > 10 | ||||
| > EOF | > EOF | ||||
| $ hg commit -m "H2" | $ hg commit -m "H2" | ||||
| created new head | created new head | ||||
| $ hg rebase -s "desc(H1)" -d "desc(H2)" -t :merge3 | $ hg rebase -s "desc(H1)" -d "desc(H2)" -t :merge3 | ||||
| rebasing 20:b57fed8d8322 "H1" | rebasing 20:b57fed8d8322 "H1" | ||||
| merging H0 | merging H0 | ||||
| $ hg debugobsolete -r tip | $ hg debugobsolete -r tip | ||||
| b57fed8d83228a8ae3748d8c3760a77638dd4f8c e509e2eb3df5d131ff7c02350bf2a9edd0c09478 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'user': 'test'} | b57fed8d83228a8ae3748d8c3760a77638dd4f8c e509e2eb3df5d131ff7c02350bf2a9edd0c09478 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'user': 'test'} | ||||
| amend closing the branch should be detected as meta change | amend closing the branch should be detected as meta change | ||||
| ---------------------------------------------------------- | ---------------------------------------------------------- | ||||
| $ hg branch closedbranch | $ hg branch closedbranch | ||||
| marked working directory as branch closedbranch | marked working directory as branch closedbranch | ||||
| $ mkcommit G0 | $ mkcommit G0 | ||||
| $ mkcommit I0 | $ mkcommit I0 | ||||
| $ hg commit --amend --close-branch | $ hg commit --amend --close-branch | ||||
| check result | check result | ||||
| $ hg debugobsolete -r . | $ hg debugobsolete -r . | ||||
| 2b5d9213db9e0e240052e89aad86f7c7a5fb3822 0 {2f599e54c1c6974299065cdf54e1ad640bfb7b5d} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'user': 'test'} | 2b5d9213db9e0e240052e89aad86f7c7a5fb3822 0 {2f599e54c1c6974299065cdf54e1ad640bfb7b5d} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'user': 'test'} | ||||
| 2f599e54c1c6974299065cdf54e1ad640bfb7b5d 12c6238b5e371eea00fd2013b12edce3f070928b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'user': 'test'} | 2f599e54c1c6974299065cdf54e1ad640bfb7b5d 12c6238b5e371eea00fd2013b12edce3f070928b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'user': 'test'} | ||||