Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 44343:8561ad49915d
revset: add a revset for parents in merge state
This may be particularly useful soon, when I'm going to change how `hg
rebase` sets its parents during conflict resolution.
Differential Revision: https://phab.mercurial-scm.org/D8041
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 29 Jan 2020 11:30:35 -0800 |
parents | 6e8678e7223a |
children | 9d2b2df2c2ba |
comparison
equal
deleted
inserted
replaced
44342:7f7c8521e9bd | 44343:8561ad49915d |
---|---|
767 for r in startrevs: | 767 for r in startrevs: |
768 subset &= dagop.revancestors(repo, baseset([r])) | 768 subset &= dagop.revancestors(repo, baseset([r])) |
769 return subset | 769 return subset |
770 | 770 |
771 | 771 |
772 @predicate(b'conflictlocal()', safe=True) | |
773 def conflictlocal(repo, subset, x): | |
774 """The local side of the merge, if currently in an unresolved merge. | |
775 | |
776 "merge" here includes merge conflicts from e.g. 'hg rebase' or 'hg graft'. | |
777 """ | |
778 getargs(x, 0, 0, _(b"conflictlocal takes no arguments")) | |
779 from . import merge | |
780 | |
781 mergestate = merge.mergestate.read(repo) | |
782 if mergestate.active() and repo.changelog.hasnode(mergestate.local): | |
783 return subset & {repo.changelog.rev(mergestate.local)} | |
784 | |
785 return baseset() | |
786 | |
787 | |
788 @predicate(b'conflictother()', safe=True) | |
789 def conflictother(repo, subset, x): | |
790 """The other side of the merge, if currently in an unresolved merge. | |
791 | |
792 "merge" here includes merge conflicts from e.g. 'hg rebase' or 'hg graft'. | |
793 """ | |
794 getargs(x, 0, 0, _(b"conflictother takes no arguments")) | |
795 from . import merge | |
796 | |
797 mergestate = merge.mergestate.read(repo) | |
798 if mergestate.active() and repo.changelog.hasnode(mergestate.other): | |
799 return subset & {repo.changelog.rev(mergestate.other)} | |
800 | |
801 return baseset() | |
802 | |
803 | |
772 @predicate(b'contains(pattern)', weight=100) | 804 @predicate(b'contains(pattern)', weight=100) |
773 def contains(repo, subset, x): | 805 def contains(repo, subset, x): |
774 """The revision's manifest contains a file matching pattern (but might not | 806 """The revision's manifest contains a file matching pattern (but might not |
775 modify it). See :hg:`help patterns` for information about file patterns. | 807 modify it). See :hg:`help patterns` for information about file patterns. |
776 | 808 |