Mercurial > hg
annotate tests/test-merge-partial-tool.t @ 48981:f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
A common class of merge conflicts is in imports/#includes/etc. It's
relatively easy to write a tool that can resolve these conflicts,
perhaps by naively just unioning the statements and leaving any
cleanup to other tools to do later [1]. Such specialized tools cannot
generally resolve all conflicts in a file, of course. Let's therefore
call them "partial merge tools". Note that the internal simplemerge
algorithm is such a partial merge tool - one that only resolves
trivial "conflicts" where one side is unchanged or both sides change
in the same way.
One can also imagine having smarter language-aware partial tools that
merge the AST. It may be useful for such tools to interactively let
the user resolve any conflicts it can't resolve itself. However,
having the option of implementing it as a partial merge tool means
that the developer doesn't *need* to create a UI for it. Instead, the
user can resolve any remaining conflicts with their regular merge tool
(e.g. `:merge3` or `meld).
We don't currently have a way to let the user define such partial
merge tools. That's what this patch addresses. It lets the user
configure partial merge tools to run. Each tool can be configured to
run only on files matching certain patterns (e.g. "*.py"). The tool
takes three inputs (local, base, other) and resolves conflicts by
updating these in place. For example, let's say the inputs are these:
base:
```
import sys
def main():
print('Hello')
```
local:
```
import os
import sys
def main():
print('Hi')
```
other:
```
import re
import sys
def main():
print('Howdy')
```
A partial merge tool could now resolve the conflicting imports by
replacing the import statements in *all* files by the following
snippet, while leaving the remainder of the files unchanged.
```
import os
import re
import sys
```
As a result, simplemerge and any regular merge tool that runs after
the partial merge tool(s) will consider the imports to be
non-conflicting and will only present the conflict in `main()` to the
user.
Differential Revision: https://phab.mercurial-scm.org/D12356
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 18 Jan 2022 13:05:21 -0800 |
parents | |
children | 9dfbea54b680 |
rev | line source |
---|---|
48981
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
1 Test support for partial-resolution tools |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
2 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
3 Create a tool that resolves conflicts after line 5 by simply dropping those |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
4 lines (even if there are no conflicts there) |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
5 $ cat >> "$TESTTMP/head.sh" <<'EOF' |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
6 > #!/bin/sh |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
7 > for f in "$@"; do |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
8 > head -5 $f > tmp |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
9 > mv -f tmp $f |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
10 > done |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
11 > EOF |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
12 $ chmod +x "$TESTTMP/head.sh" |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
13 ...and another tool that keeps only the last 5 lines instead of the first 5. |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
14 $ cat >> "$TESTTMP/tail.sh" <<'EOF' |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
15 > #!/bin/sh |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
16 > for f in "$@"; do |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
17 > tail -5 $f > tmp |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
18 > mv -f tmp $f |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
19 > done |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
20 > EOF |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
21 $ chmod +x "$TESTTMP/tail.sh" |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
22 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
23 Set up both tools to run on all patterns (the default), and let the `tail` tool |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
24 run after the `head` tool, which means it will have no effect (we'll override it |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
25 to test order later) |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
26 $ cat >> "$HGRCPATH" <<EOF |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
27 > [partial-merge-tools] |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
28 > head.executable=$TESTTMP/head.sh |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
29 > tail.executable=$TESTTMP/tail.sh |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
30 > tail.order=1 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
31 > EOF |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
32 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
33 $ make_commit() { |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
34 > echo "$@" | xargs -n1 > file |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
35 > hg add file 2> /dev/null |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
36 > hg ci -m "$*" |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
37 > } |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
38 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
39 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
40 Let a partial-resolution tool resolve some conflicts and leave other conflicts |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
41 for the regular merge tool (:merge3 here) |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
42 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
43 $ hg init repo |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
44 $ cd repo |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
45 $ make_commit a b c d e f |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
46 $ make_commit a b2 c d e f2 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
47 $ hg up 0 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
48 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
49 $ make_commit a b3 c d e f3 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
50 created new head |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
51 $ hg merge 1 -t :merge3 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
52 merging file |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
53 warning: conflicts while merging file! (edit, then use 'hg resolve --mark') |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
54 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
55 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
56 [1] |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
57 $ cat file |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
58 a |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
59 <<<<<<< working copy: e11a49d4b620 - test: a b3 c d e f3 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
60 b3 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
61 ||||||| common ancestor: 8ae8bb9cc43a - test: a b c d e f |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
62 b |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
63 ======= |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
64 b2 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
65 >>>>>>> merge rev: fbc096a40cc5 - test: a b2 c d e f2 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
66 c |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
67 d |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
68 e |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
69 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
70 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
71 With premerge=keep, the partial-resolution tools runs before and doesn't see |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
72 the conflict markers |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
73 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
74 $ hg up -C 2 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
75 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
76 $ cat >> .hg/hgrc <<EOF |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
77 > [merge-tools] |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
78 > my-local.executable = cat |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
79 > my-local.args = $local |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
80 > my-local.premerge = keep-merge3 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
81 > EOF |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
82 $ hg merge 1 -t my-local |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
83 merging file |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
84 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
85 (branch merge, don't forget to commit) |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
86 $ cat file |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
87 a |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
88 <<<<<<< working copy: e11a49d4b620 - test: a b3 c d e f3 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
89 b3 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
90 ||||||| common ancestor: 8ae8bb9cc43a - test: a b c d e f |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
91 b |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
92 ======= |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
93 b2 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
94 >>>>>>> merge rev: fbc096a40cc5 - test: a b2 c d e f2 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
95 c |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
96 d |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
97 e |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
98 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
99 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
100 When a partial-resolution tool resolves all conflicts, the resolution should |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
101 be recorded and the regular merge tool should not be invoked for the file. |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
102 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
103 $ hg up -C 0 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
104 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
105 $ make_commit a b c d e f2 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
106 created new head |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
107 $ hg up 0 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
109 $ make_commit a b c d e f3 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
110 created new head |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
111 $ hg merge 3 -t false |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
112 merging file |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
113 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
114 (branch merge, don't forget to commit) |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
115 $ cat file |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
116 a |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
117 b |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
118 c |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
119 d |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
120 e |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
121 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
122 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
123 Only tools whose patterns match are run. We make `head` not match here, so |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
124 only `tail` should run |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
125 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
126 $ hg up -C 4 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
127 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
128 $ hg merge 3 -t :merge3 --config partial-merge-tools.head.patterns=other |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
129 merging file |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
130 warning: conflicts while merging file! (edit, then use 'hg resolve --mark') |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
131 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
132 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
133 [1] |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
134 $ cat file |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
135 b |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
136 c |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
137 d |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
138 e |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
139 <<<<<<< working copy: d57edaa6e21a - test: a b c d e f3 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
140 f3 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
141 ||||||| common ancestor: 8ae8bb9cc43a - test: a b c d e f |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
142 f |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
143 ======= |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
144 f2 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
145 >>>>>>> merge rev: 8c217da987be - test: a b c d e f2 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
146 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
147 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
148 If there are several matching tools, they are run in requested order. We move |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
149 `head` after `tail` in order here so it has no effect (the conflict in "f" thus |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
150 remains). |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
151 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
152 $ hg up -C 4 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
153 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
154 $ hg merge 3 -t :merge3 --config partial-merge-tools.head.order=2 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
155 merging file |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
156 warning: conflicts while merging file! (edit, then use 'hg resolve --mark') |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
157 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
158 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
159 [1] |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
160 $ cat file |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
161 b |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
162 c |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
163 d |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
164 e |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
165 <<<<<<< working copy: d57edaa6e21a - test: a b c d e f3 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
166 f3 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
167 ||||||| common ancestor: 8ae8bb9cc43a - test: a b c d e f |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
168 f |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
169 ======= |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
170 f2 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
171 >>>>>>> merge rev: 8c217da987be - test: a b c d e f2 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
172 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
173 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
174 When using "nomerge" tools (e.g. `:other`), the partial-resolution tools |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
175 should not be run. |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
176 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
177 $ hg up -C 4 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
178 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
179 $ hg merge 3 -t :other |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
180 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
181 (branch merge, don't forget to commit) |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
182 $ cat file |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
183 a |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
184 b |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
185 c |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
186 d |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
187 e |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
188 f2 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
189 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
190 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
191 If a partial-resolution tool resolved some conflict and simplemerge can |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
192 merge the rest, then the regular merge tool should not be used. Here we merge |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
193 "a b c d e3 f3" with "a b2 c d e f2". The `head` tool resolves the conflict in |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
194 "f" and the internal simplemerge merges the remaining changes in "b" and "e". |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
195 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
196 $ hg up -C 0 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
197 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
198 $ make_commit a b c d e3 f3 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
199 created new head |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
200 $ hg merge 1 -t false |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
201 merging file |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
202 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
203 (branch merge, don't forget to commit) |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
204 $ cat file |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
205 a |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
206 b2 |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
207 c |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
208 d |
f3aafd785e65
filemerge: add support for partial conflict resolution by external tool
Martin von Zweigbergk <martinvonz@google.com>
parents:
diff
changeset
|
209 e3 |