Mercurial > public > mercurial-scm > hg
diff 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 |
line wrap: on
line diff
--- a/mercurial/revset.py Fri Jan 10 17:46:10 2020 -0800 +++ b/mercurial/revset.py Wed Jan 29 11:30:35 2020 -0800 @@ -769,6 +769,38 @@ return subset +@predicate(b'conflictlocal()', safe=True) +def conflictlocal(repo, subset, x): + """The local side of the merge, if currently in an unresolved merge. + + "merge" here includes merge conflicts from e.g. 'hg rebase' or 'hg graft'. + """ + getargs(x, 0, 0, _(b"conflictlocal takes no arguments")) + from . import merge + + mergestate = merge.mergestate.read(repo) + if mergestate.active() and repo.changelog.hasnode(mergestate.local): + return subset & {repo.changelog.rev(mergestate.local)} + + return baseset() + + +@predicate(b'conflictother()', safe=True) +def conflictother(repo, subset, x): + """The other side of the merge, if currently in an unresolved merge. + + "merge" here includes merge conflicts from e.g. 'hg rebase' or 'hg graft'. + """ + getargs(x, 0, 0, _(b"conflictother takes no arguments")) + from . import merge + + mergestate = merge.mergestate.read(repo) + if mergestate.active() and repo.changelog.hasnode(mergestate.other): + return subset & {repo.changelog.rev(mergestate.other)} + + return baseset() + + @predicate(b'contains(pattern)', weight=100) def contains(repo, subset, x): """The revision's manifest contains a file matching pattern (but might not