Show More
@@ -1,167 +1,169 b'' | |||
|
1 | 1 | test that a commit clears the merge state. |
|
2 | 2 | |
|
3 | 3 | $ hg init repo |
|
4 | 4 | $ cd repo |
|
5 | 5 | |
|
6 | 6 | $ echo foo > file1 |
|
7 | 7 | $ echo foo > file2 |
|
8 | 8 | $ hg commit -Am 'add files' |
|
9 | 9 | adding file1 |
|
10 | 10 | adding file2 |
|
11 | 11 | |
|
12 | 12 | $ echo bar >> file1 |
|
13 | 13 | $ echo bar >> file2 |
|
14 | 14 | $ hg commit -Am 'append bar to files' |
|
15 | 15 | |
|
16 | 16 | create a second head with conflicting edits |
|
17 | 17 | |
|
18 | 18 | $ hg up -C 0 |
|
19 | 19 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
20 | 20 | $ echo baz >> file1 |
|
21 | 21 | $ echo baz >> file2 |
|
22 | 22 | $ hg commit -Am 'append baz to files' |
|
23 | 23 | created new head |
|
24 | 24 | |
|
25 | 25 | create a third head with no conflicting edits |
|
26 | 26 | $ hg up -qC 0 |
|
27 | 27 | $ echo foo > file3 |
|
28 | 28 | $ hg commit -Am 'add non-conflicting file' |
|
29 | 29 | adding file3 |
|
30 | 30 | created new head |
|
31 | 31 | |
|
32 | 32 | failing merge |
|
33 | 33 | |
|
34 | 34 | $ hg up -qC 2 |
|
35 | 35 | $ hg merge --tool=internal:fail 1 |
|
36 | 36 | 0 files updated, 0 files merged, 0 files removed, 2 files unresolved |
|
37 | 37 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
38 | 38 | [1] |
|
39 | 39 | |
|
40 | 40 | resolve -l should contain unresolved entries |
|
41 | 41 | |
|
42 | 42 | $ hg resolve -l |
|
43 | 43 | U file1 |
|
44 | 44 | U file2 |
|
45 | 45 | |
|
46 | 46 | $ hg resolve -l --no-status |
|
47 | 47 | file1 |
|
48 | 48 | file2 |
|
49 | 49 | |
|
50 | 50 | resolving an unknown path should emit a warning, but not for -l |
|
51 | 51 | |
|
52 | 52 | $ hg resolve -m does-not-exist |
|
53 | 53 | arguments do not match paths that need resolving |
|
54 | 54 | $ hg resolve -l does-not-exist |
|
55 | 55 | |
|
56 | 56 | resolve the failure |
|
57 | 57 | |
|
58 | 58 | $ echo resolved > file1 |
|
59 | 59 | $ hg resolve -m file1 |
|
60 | 60 | |
|
61 | 61 | resolve -l should show resolved file as resolved |
|
62 | 62 | |
|
63 | 63 | $ hg resolve -l |
|
64 | 64 | R file1 |
|
65 | 65 | U file2 |
|
66 | 66 | |
|
67 | 67 | $ hg resolve -l -Tjson |
|
68 | 68 | [ |
|
69 | 69 | { |
|
70 | 70 | "path": "file1", |
|
71 | 71 | "status": "R" |
|
72 | 72 | }, |
|
73 | 73 | { |
|
74 | 74 | "path": "file2", |
|
75 | 75 | "status": "U" |
|
76 | 76 | } |
|
77 | 77 | ] |
|
78 | 78 | |
|
79 | 79 | resolve -m without paths should mark all resolved |
|
80 | 80 | |
|
81 | 81 | $ hg resolve -m |
|
82 | 82 | (no more unresolved files) |
|
83 | 83 | $ hg commit -m 'resolved' |
|
84 | 84 | |
|
85 | 85 | resolve -l should be empty after commit |
|
86 | 86 | |
|
87 | 87 | $ hg resolve -l |
|
88 | 88 | |
|
89 | 89 | $ hg resolve -l -Tjson |
|
90 | 90 | [ |
|
91 | 91 | ] |
|
92 | 92 | |
|
93 | 93 | resolve --all should abort when no merge in progress |
|
94 | 94 | |
|
95 | 95 | $ hg resolve --all |
|
96 | 96 | abort: resolve command not applicable when not merging |
|
97 | 97 | [255] |
|
98 | 98 | |
|
99 | 99 | resolve -m should abort when no merge in progress |
|
100 | 100 | |
|
101 | 101 | $ hg resolve -m |
|
102 | 102 | abort: resolve command not applicable when not merging |
|
103 | 103 | [255] |
|
104 | 104 | |
|
105 | 105 | set up conflict-free merge |
|
106 | 106 | |
|
107 | 107 | $ hg up -qC 3 |
|
108 | 108 | $ hg merge 1 |
|
109 | 109 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
110 | 110 | (branch merge, don't forget to commit) |
|
111 | 111 | |
|
112 | 112 | resolve --all should do nothing in merge without conflicts |
|
113 | 113 | $ hg resolve --all |
|
114 | 114 | (no more unresolved files) |
|
115 | 115 | |
|
116 | 116 | resolve -m should do nothing in merge without conflicts |
|
117 | 117 | |
|
118 | 118 | $ hg resolve -m |
|
119 | 119 | (no more unresolved files) |
|
120 | 120 | |
|
121 | 121 | get back to conflicting state |
|
122 | 122 | |
|
123 | 123 | $ hg up -qC 2 |
|
124 | 124 | $ hg merge --tool=internal:fail 1 |
|
125 | 125 | 0 files updated, 0 files merged, 0 files removed, 2 files unresolved |
|
126 | 126 | use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
127 | 127 | [1] |
|
128 | 128 | |
|
129 | 129 | resolve without arguments should suggest --all |
|
130 | 130 | $ hg resolve |
|
131 | 131 | abort: no files or directories specified |
|
132 | 132 | (use --all to re-merge all unresolved files) |
|
133 | 133 | [255] |
|
134 | 134 | |
|
135 | 135 | resolve --all should re-merge all unresolved files |
|
136 |
$ hg resolve - |
|
|
136 | $ hg resolve --all | |
|
137 | merging file1 | |
|
137 | 138 | warning: conflicts while merging file1! (edit, then use 'hg resolve --mark') |
|
139 | merging file2 | |
|
138 | 140 | warning: conflicts while merging file2! (edit, then use 'hg resolve --mark') |
|
139 | 141 | [1] |
|
140 | 142 | $ grep '<<<' file1 > /dev/null |
|
141 | 143 | $ grep '<<<' file2 > /dev/null |
|
142 | 144 | |
|
143 | 145 | resolve <file> should re-merge file |
|
144 | 146 | $ echo resolved > file1 |
|
145 | 147 | $ hg resolve -q file1 |
|
146 | 148 | warning: conflicts while merging file1! (edit, then use 'hg resolve --mark') |
|
147 | 149 | [1] |
|
148 | 150 | $ grep '<<<' file1 > /dev/null |
|
149 | 151 | |
|
150 | 152 | resolve <file> should do nothing if 'file' was marked resolved |
|
151 | 153 | $ echo resolved > file1 |
|
152 | 154 | $ hg resolve -m file1 |
|
153 | 155 | $ hg resolve -q file1 |
|
154 | 156 | $ cat file1 |
|
155 | 157 | resolved |
|
156 | 158 | |
|
157 | 159 | test crashed merge with empty mergestate |
|
158 | 160 | |
|
159 | 161 | $ hg up -qC 1 |
|
160 | 162 | $ mkdir .hg/merge |
|
161 | 163 | $ touch .hg/merge/state |
|
162 | 164 | |
|
163 | 165 | resolve -l should be empty |
|
164 | 166 | |
|
165 | 167 | $ hg resolve -l |
|
166 | 168 | |
|
167 | 169 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now