##// END OF EJS Templates
revset: add a revset for parents in merge state...
Martin von Zweigbergk -
r44817:8561ad49 default
parent child Browse files
Show More
@@ -769,6 +769,38 b' def commonancestors(repo, subset, x):'
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
@@ -3,6 +3,11 b''
3 * `hg purge`/`hg clean` can now delete ignored files instead of
3 * `hg purge`/`hg clean` can now delete ignored files instead of
4 untracked files, with the new -i flag.
4 untracked files, with the new -i flag.
5
5
6 * New `conflictlocal()` and `conflictother()` revsets returns the
7 commits that are being merged, when there are conflicts. Also works
8 for conflicts caused by e.g. `hg graft`.
9
10
6 == New Experimental Features ==
11 == New Experimental Features ==
7
12
8
13
@@ -23,3 +23,37 b' Test hg behaves when committing with a m'
23 abort: cannot commit merge with missing files
23 abort: cannot commit merge with missing files
24 [255]
24 [255]
25
25
26
27 Test conflict*() revsets
28
29 # Bad usage
30 $ hg log -r 'conflictlocal(foo)'
31 hg: parse error: conflictlocal takes no arguments
32 [255]
33 $ hg log -r 'conflictother(foo)'
34 hg: parse error: conflictother takes no arguments
35 [255]
36 $ hg co -C .
37 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 # No merge parents when not merging
39 $ hg log -r 'conflictlocal() + conflictother()'
40 # No merge parents when there is no conflict
41 $ hg merge 1
42 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
43 (branch merge, don't forget to commit)
44 $ hg log -r 'conflictlocal() + conflictother()'
45 $ hg co -C .
46 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
47 $ echo conflict > b
48 $ hg ci -Aqm 'conflicting change to b'
49 $ hg merge 1
50 merging b
51 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
52 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
53 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
54 [1]
55 # Shows merge parents when there is a conflict
56 $ hg log -r 'conflictlocal()' -T '{rev} {desc}\n'
57 3 conflicting change to b
58 $ hg log -r 'conflictother()' -T '{rev} {desc}\n'
59 1 commit #1
General Comments 0
You need to be logged in to leave comments. Login now