Show More
@@ -1,616 +1,618 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 merge --abort' 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 | tell users how they could have used resolve |
|
57 | 57 | |
|
58 | 58 | $ mkdir nested |
|
59 | 59 | $ cd nested |
|
60 | 60 | $ hg resolve -m file1 |
|
61 | 61 | arguments do not match paths that need resolving |
|
62 | 62 | (try: hg resolve -m path:file1) |
|
63 | 63 | $ hg resolve -m file1 filez |
|
64 | 64 | arguments do not match paths that need resolving |
|
65 | 65 | (try: hg resolve -m path:file1 path:filez) |
|
66 | 66 | $ hg resolve -m path:file1 path:filez |
|
67 | 67 | $ hg resolve -l |
|
68 | 68 | R file1 |
|
69 | 69 | U file2 |
|
70 | 70 | $ hg resolve --re-merge filez file2 |
|
71 | 71 | arguments do not match paths that need resolving |
|
72 | 72 | (try: hg resolve --re-merge path:filez path:file2) |
|
73 | 73 | $ hg resolve -m filez file2 |
|
74 | 74 | arguments do not match paths that need resolving |
|
75 | 75 | (try: hg resolve -m path:filez path:file2) |
|
76 | 76 | $ hg resolve -m path:filez path:file2 |
|
77 | 77 | (no more unresolved files) |
|
78 | 78 | $ hg resolve -l |
|
79 | 79 | R file1 |
|
80 | 80 | R file2 |
|
81 | 81 | |
|
82 | 82 | cleanup |
|
83 | 83 | $ hg resolve -u |
|
84 | 84 | $ cd .. |
|
85 | 85 | $ rmdir nested |
|
86 | 86 | |
|
87 | 87 | don't allow marking or unmarking driver-resolved files |
|
88 | 88 | |
|
89 | 89 | $ cat > $TESTTMP/markdriver.py << EOF |
|
90 | 90 | > '''mark and unmark files as driver-resolved''' |
|
91 | 91 | > from mercurial import ( |
|
92 | 92 | > merge, |
|
93 | 93 | > pycompat, |
|
94 | 94 | > registrar, |
|
95 | 95 | > scmutil, |
|
96 | 96 | > ) |
|
97 | 97 | > cmdtable = {} |
|
98 | 98 | > command = registrar.command(cmdtable) |
|
99 | 99 | > @command(b'markdriver', |
|
100 | 100 | > [(b'u', b'unmark', None, b'')], |
|
101 | 101 | > b'FILE...') |
|
102 | 102 | > def markdriver(ui, repo, *pats, **opts): |
|
103 | 103 | > wlock = repo.wlock() |
|
104 | 104 | > opts = pycompat.byteskwargs(opts) |
|
105 | 105 | > try: |
|
106 | 106 | > ms = merge.mergestate.read(repo) |
|
107 | 107 | > m = scmutil.match(repo[None], pats, opts) |
|
108 | 108 | > for f in ms: |
|
109 | 109 | > if not m(f): |
|
110 | 110 | > continue |
|
111 | 111 | > if not opts[b'unmark']: |
|
112 | 112 | > ms.mark(f, b'd') |
|
113 | 113 | > else: |
|
114 | 114 | > ms.mark(f, b'u') |
|
115 | 115 | > ms.commit() |
|
116 | 116 | > finally: |
|
117 | 117 | > wlock.release() |
|
118 | 118 | > EOF |
|
119 | 119 | $ hg --config extensions.markdriver=$TESTTMP/markdriver.py markdriver file1 |
|
120 | 120 | $ hg resolve --list |
|
121 | 121 | D file1 |
|
122 | 122 | U file2 |
|
123 | 123 | $ hg resolve --mark file1 |
|
124 | 124 | not marking file1 as it is driver-resolved |
|
125 | 125 | this should not print out file1 |
|
126 | 126 | $ hg resolve --mark --all |
|
127 | 127 | (no more unresolved files -- run "hg resolve --all" to conclude) |
|
128 | 128 | $ hg resolve --mark 'glob:file*' |
|
129 | 129 | (no more unresolved files -- run "hg resolve --all" to conclude) |
|
130 | 130 | $ hg resolve --list |
|
131 | 131 | D file1 |
|
132 | 132 | R file2 |
|
133 | 133 | $ hg resolve --unmark file1 |
|
134 | 134 | not unmarking file1 as it is driver-resolved |
|
135 | 135 | (no more unresolved files -- run "hg resolve --all" to conclude) |
|
136 | 136 | $ hg resolve --unmark --all |
|
137 | 137 | $ hg resolve --list |
|
138 | 138 | D file1 |
|
139 | 139 | U file2 |
|
140 | 140 | $ hg --config extensions.markdriver=$TESTTMP/markdriver.py markdriver --unmark file1 |
|
141 | 141 | $ hg resolve --list |
|
142 | 142 | U file1 |
|
143 | 143 | U file2 |
|
144 | 144 | |
|
145 | 145 | resolve the failure |
|
146 | 146 | |
|
147 | 147 | $ echo resolved > file1 |
|
148 | 148 | $ hg resolve -m file1 |
|
149 | 149 | |
|
150 | 150 | resolve -l should show resolved file as resolved |
|
151 | 151 | |
|
152 | 152 | $ hg resolve -l |
|
153 | 153 | R file1 |
|
154 | 154 | U file2 |
|
155 | 155 | |
|
156 | 156 | $ hg resolve -l -Tjson |
|
157 | 157 | [ |
|
158 | 158 | { |
|
159 | 159 | "mergestatus": "R", |
|
160 | 160 | "path": "file1" |
|
161 | 161 | }, |
|
162 | 162 | { |
|
163 | 163 | "mergestatus": "U", |
|
164 | 164 | "path": "file2" |
|
165 | 165 | } |
|
166 | 166 | ] |
|
167 | 167 | |
|
168 | 168 | $ hg resolve -l -T '{path} {mergestatus} {status} {p1rev} {p2rev}\n' |
|
169 | 169 | file1 R M 2 1 |
|
170 | 170 | file2 U M 2 1 |
|
171 | 171 | |
|
172 | 172 | resolve -m without paths should mark all resolved |
|
173 | 173 | |
|
174 | 174 | $ hg resolve -m |
|
175 | 175 | (no more unresolved files) |
|
176 | 176 | $ hg commit -m 'resolved' |
|
177 | 177 | |
|
178 | 178 | resolve -l should be empty after commit |
|
179 | 179 | |
|
180 | 180 | $ hg resolve -l |
|
181 | 181 | |
|
182 | 182 | $ hg resolve -l -Tjson |
|
183 | 183 | [ |
|
184 | 184 | ] |
|
185 | 185 | |
|
186 | 186 | resolve --all should abort when no merge in progress |
|
187 | 187 | |
|
188 | 188 | $ hg resolve --all |
|
189 | 189 | abort: resolve command not applicable when not merging |
|
190 | 190 | [255] |
|
191 | 191 | |
|
192 | 192 | resolve -m should abort when no merge in progress |
|
193 | 193 | |
|
194 | 194 | $ hg resolve -m |
|
195 | 195 | abort: resolve command not applicable when not merging |
|
196 | 196 | [255] |
|
197 | 197 | |
|
198 | 198 | can not update or merge when there are unresolved conflicts |
|
199 | 199 | |
|
200 | 200 | $ hg up -qC 0 |
|
201 | 201 | $ echo quux >> file1 |
|
202 | 202 | $ hg up 1 |
|
203 | 203 | merging file1 |
|
204 | 204 | warning: conflicts while merging file1! (edit, then use 'hg resolve --mark') |
|
205 | 205 | 1 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
206 | 206 | use 'hg resolve' to retry unresolved file merges |
|
207 | 207 | [1] |
|
208 | 208 | $ hg up 0 |
|
209 | 209 | abort: outstanding merge conflicts |
|
210 | 210 | [255] |
|
211 | 211 | $ hg merge 2 |
|
212 | 212 | abort: outstanding merge conflicts |
|
213 | 213 | [255] |
|
214 | 214 | $ hg merge --force 2 |
|
215 | 215 | abort: outstanding merge conflicts |
|
216 | 216 | [255] |
|
217 | 217 | |
|
218 | 218 | set up conflict-free merge |
|
219 | 219 | |
|
220 | 220 | $ hg up -qC 3 |
|
221 | 221 | $ hg merge 1 |
|
222 | 222 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
223 | 223 | (branch merge, don't forget to commit) |
|
224 | 224 | |
|
225 | 225 | resolve --all should do nothing in merge without conflicts |
|
226 | 226 | $ hg resolve --all |
|
227 | 227 | (no more unresolved files) |
|
228 | 228 | |
|
229 | 229 | resolve -m should do nothing in merge without conflicts |
|
230 | 230 | |
|
231 | 231 | $ hg resolve -m |
|
232 | 232 | (no more unresolved files) |
|
233 | 233 | |
|
234 | 234 | get back to conflicting state |
|
235 | 235 | |
|
236 | 236 | $ hg up -qC 2 |
|
237 | 237 | $ hg merge --tool=internal:fail 1 |
|
238 | 238 | 0 files updated, 0 files merged, 0 files removed, 2 files unresolved |
|
239 | 239 | use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon |
|
240 | 240 | [1] |
|
241 | 241 | |
|
242 | 242 | resolve without arguments should suggest --all |
|
243 | 243 | $ hg resolve |
|
244 | 244 | abort: no files or directories specified |
|
245 | 245 | (use --all to re-merge all unresolved files) |
|
246 | 246 | [255] |
|
247 | 247 | |
|
248 | 248 | resolve --all should re-merge all unresolved files |
|
249 | 249 | $ hg resolve --all |
|
250 | 250 | merging file1 |
|
251 | 251 | merging file2 |
|
252 | 252 | warning: conflicts while merging file1! (edit, then use 'hg resolve --mark') |
|
253 | 253 | warning: conflicts while merging file2! (edit, then use 'hg resolve --mark') |
|
254 | 254 | [1] |
|
255 | 255 | $ cat file1.orig |
|
256 | 256 | foo |
|
257 | 257 | baz |
|
258 | 258 | $ cat file2.orig |
|
259 | 259 | foo |
|
260 | 260 | baz |
|
261 | 261 | |
|
262 | 262 | .orig files should exists where specified |
|
263 | 263 | $ hg resolve --all --verbose --config 'ui.origbackuppath=.hg/origbackups' |
|
264 | 264 | merging file1 |
|
265 | 265 | creating directory: $TESTTMP/repo/.hg/origbackups |
|
266 | 266 | merging file2 |
|
267 | 267 | warning: conflicts while merging file1! (edit, then use 'hg resolve --mark') |
|
268 | 268 | warning: conflicts while merging file2! (edit, then use 'hg resolve --mark') |
|
269 | 269 | [1] |
|
270 | 270 | $ ls .hg/origbackups |
|
271 | 271 | file1 |
|
272 | 272 | file2 |
|
273 | 273 | $ grep '<<<' file1 > /dev/null |
|
274 | 274 | $ grep '<<<' file2 > /dev/null |
|
275 | 275 | |
|
276 | 276 | resolve <file> should re-merge file |
|
277 | 277 | $ echo resolved > file1 |
|
278 | 278 | $ hg resolve -q file1 |
|
279 | 279 | warning: conflicts while merging file1! (edit, then use 'hg resolve --mark') |
|
280 | 280 | [1] |
|
281 | 281 | $ grep '<<<' file1 > /dev/null |
|
282 | 282 | |
|
283 | 283 | test .orig behavior with resolve |
|
284 | 284 | |
|
285 | 285 | $ hg resolve -q file1 --tool "sh -c 'f --dump \"$TESTTMP/repo/file1.orig\"'" |
|
286 | 286 | $TESTTMP/repo/file1.orig: |
|
287 | 287 | >>> |
|
288 | 288 | foo |
|
289 | 289 | baz |
|
290 | 290 | <<< |
|
291 | 291 | |
|
292 | 292 | resolve <file> should do nothing if 'file' was marked resolved |
|
293 | 293 | $ echo resolved > file1 |
|
294 | 294 | $ hg resolve -m file1 |
|
295 | 295 | $ hg resolve -q file1 |
|
296 | 296 | $ cat file1 |
|
297 | 297 | resolved |
|
298 | 298 | |
|
299 | 299 | insert unsupported advisory merge record |
|
300 | 300 | |
|
301 | 301 | $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -x |
|
302 | 302 | $ hg debugmergestate |
|
303 | 303 | * version 2 records |
|
304 | 304 | local: 57653b9f834a4493f7240b0681efcb9ae7cab745 |
|
305 | 305 | other: dc77451844e37f03f5c559e3b8529b2b48d381d1 |
|
306 | 306 | labels: |
|
307 | 307 | local: working copy |
|
308 | 308 | other: merge rev |
|
309 | 309 | unrecognized entry: x advisory record |
|
310 | 310 | file extras: file1 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac) |
|
311 | 311 | file: file1 (record type "F", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390) |
|
312 | 312 | local path: file1 (flags "") |
|
313 | 313 | ancestor path: file1 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd) |
|
314 | 314 | other path: file1 (node 6f4310b00b9a147241b071a60c28a650827fb03d) |
|
315 | 315 | file extras: file2 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac) |
|
316 | 316 | file: file2 (record type "F", state "u", hash cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523) |
|
317 | 317 | local path: file2 (flags "") |
|
318 | 318 | ancestor path: file2 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd) |
|
319 | 319 | other path: file2 (node 6f4310b00b9a147241b071a60c28a650827fb03d) |
|
320 | 320 | $ hg resolve -l |
|
321 | 321 | R file1 |
|
322 | 322 | U file2 |
|
323 | 323 | |
|
324 | 324 | insert unsupported mandatory merge record |
|
325 | 325 | |
|
326 | 326 | $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py fakemergerecord -X |
|
327 | 327 | $ hg debugmergestate |
|
328 | 328 | * version 2 records |
|
329 | 329 | local: 57653b9f834a4493f7240b0681efcb9ae7cab745 |
|
330 | 330 | other: dc77451844e37f03f5c559e3b8529b2b48d381d1 |
|
331 | 331 | labels: |
|
332 | 332 | local: working copy |
|
333 | 333 | other: merge rev |
|
334 | 334 | file extras: file1 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac) |
|
335 | 335 | file: file1 (record type "F", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390) |
|
336 | 336 | local path: file1 (flags "") |
|
337 | 337 | ancestor path: file1 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd) |
|
338 | 338 | other path: file1 (node 6f4310b00b9a147241b071a60c28a650827fb03d) |
|
339 | 339 | file extras: file2 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac) |
|
340 | 340 | file: file2 (record type "F", state "u", hash cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523) |
|
341 | 341 | local path: file2 (flags "") |
|
342 | 342 | ancestor path: file2 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd) |
|
343 | 343 | other path: file2 (node 6f4310b00b9a147241b071a60c28a650827fb03d) |
|
344 | 344 | unrecognized entry: X mandatory record |
|
345 | 345 | $ hg resolve -l |
|
346 | 346 | abort: unsupported merge state records: X |
|
347 | 347 | (see https://mercurial-scm.org/wiki/MergeStateRecords for more information) |
|
348 | 348 | [255] |
|
349 | 349 | $ hg resolve -ma |
|
350 | 350 | abort: unsupported merge state records: X |
|
351 | 351 | (see https://mercurial-scm.org/wiki/MergeStateRecords for more information) |
|
352 | 352 | [255] |
|
353 | 353 | $ hg summary |
|
354 | 354 | warning: merge state has unsupported record types: X |
|
355 | 355 | parent: 2:57653b9f834a |
|
356 | 356 | append baz to files |
|
357 | 357 | parent: 1:dc77451844e3 |
|
358 | 358 | append bar to files |
|
359 | 359 | branch: default |
|
360 | 360 | commit: 2 modified, 2 unknown (merge) |
|
361 | 361 | update: 2 new changesets (update) |
|
362 | 362 | phases: 5 draft |
|
363 | 363 | |
|
364 | 364 | update --clean shouldn't abort on unsupported records |
|
365 | 365 | |
|
366 | 366 | $ hg up -qC 1 |
|
367 | 367 | $ hg debugmergestate |
|
368 | 368 | no merge state found |
|
369 | 369 | |
|
370 | 370 | test crashed merge with empty mergestate |
|
371 | 371 | |
|
372 | 372 | $ mkdir .hg/merge |
|
373 | 373 | $ touch .hg/merge/state |
|
374 | 374 | |
|
375 | 375 | resolve -l should be empty |
|
376 | 376 | |
|
377 | 377 | $ hg resolve -l |
|
378 | 378 | |
|
379 | 379 | resolve -m can be configured to look for remaining conflict markers |
|
380 | 380 | $ hg up -qC 2 |
|
381 | 381 | $ hg merge -q --tool=internal:merge 1 |
|
382 | 382 | warning: conflicts while merging file1! (edit, then use 'hg resolve --mark') |
|
383 | 383 | warning: conflicts while merging file2! (edit, then use 'hg resolve --mark') |
|
384 | 384 | [1] |
|
385 | 385 | $ hg resolve -l |
|
386 | 386 | U file1 |
|
387 | 387 | U file2 |
|
388 | 388 | $ echo 'remove markers' > file1 |
|
389 | 389 | $ hg --config commands.resolve.mark-check=abort resolve -m |
|
390 | 390 | warning: the following files still have conflict markers: |
|
391 | 391 | file2 |
|
392 | 392 | abort: conflict markers detected |
|
393 | 393 | (use --all to mark anyway) |
|
394 | 394 | [255] |
|
395 | 395 | $ hg resolve -l |
|
396 | 396 | U file1 |
|
397 | 397 | U file2 |
|
398 | 398 | Try with --all from the hint |
|
399 | 399 | $ hg --config commands.resolve.mark-check=abort resolve -m --all |
|
400 | 400 | warning: the following files still have conflict markers: |
|
401 | 401 | file2 |
|
402 | 402 | (no more unresolved files) |
|
403 | 403 | $ hg resolve -l |
|
404 | 404 | R file1 |
|
405 | 405 | R file2 |
|
406 | 406 | Test option value 'warn' |
|
407 | 407 | $ hg resolve --unmark |
|
408 | 408 | $ hg resolve -l |
|
409 | 409 | U file1 |
|
410 | 410 | U file2 |
|
411 | 411 | $ hg --config commands.resolve.mark-check=warn resolve -m |
|
412 | 412 | warning: the following files still have conflict markers: |
|
413 | 413 | file2 |
|
414 | 414 | (no more unresolved files) |
|
415 | 415 | $ hg resolve -l |
|
416 | 416 | R file1 |
|
417 | 417 | R file2 |
|
418 | 418 | If the file is already marked as resolved, we don't warn about it |
|
419 | 419 | $ hg resolve --unmark file1 |
|
420 | 420 | $ hg resolve -l |
|
421 | 421 | U file1 |
|
422 | 422 | R file2 |
|
423 | 423 | $ hg --config commands.resolve.mark-check=warn resolve -m |
|
424 | 424 | (no more unresolved files) |
|
425 | 425 | $ hg resolve -l |
|
426 | 426 | R file1 |
|
427 | 427 | R file2 |
|
428 | 428 | If the user passes an invalid value, we treat it as 'none'. |
|
429 | 429 | $ hg resolve --unmark |
|
430 | 430 | $ hg resolve -l |
|
431 | 431 | U file1 |
|
432 | 432 | U file2 |
|
433 | 433 | $ hg --config commands.resolve.mark-check=nope resolve -m |
|
434 | 434 | (no more unresolved files) |
|
435 | 435 | $ hg resolve -l |
|
436 | 436 | R file1 |
|
437 | 437 | R file2 |
|
438 | Test explicitly setting the otion to 'none' | |
|
438 | Test explicitly setting the option to 'none' | |
|
439 | 439 | $ hg resolve --unmark |
|
440 | 440 | $ hg resolve -l |
|
441 | 441 | U file1 |
|
442 | 442 | U file2 |
|
443 | 443 | $ hg --config commands.resolve.mark-check=none resolve -m |
|
444 | 444 | (no more unresolved files) |
|
445 | 445 | $ hg resolve -l |
|
446 | 446 | R file1 |
|
447 | 447 | R file2 |
|
448 | 448 | Testing the --re-merge flag |
|
449 | 449 | $ hg resolve --unmark file1 |
|
450 | 450 | $ hg resolve -l |
|
451 | 451 | U file1 |
|
452 | 452 | R file2 |
|
453 | 453 | $ hg resolve --mark --re-merge |
|
454 | 454 | abort: too many actions specified |
|
455 | 455 | [255] |
|
456 | 456 | $ hg resolve --re-merge --all |
|
457 | 457 | merging file1 |
|
458 | 458 | warning: conflicts while merging file1! (edit, then use 'hg resolve --mark') |
|
459 | 459 | [1] |
|
460 | 460 | Explicit re-merge |
|
461 | 461 | $ hg resolve --unmark file1 |
|
462 | 462 | $ hg resolve --config commands.resolve.explicit-re-merge=1 --all |
|
463 | 463 | abort: no action specified |
|
464 | 464 | (use --mark, --unmark, --list or --re-merge) |
|
465 | 465 | [255] |
|
466 | 466 | $ hg resolve --config commands.resolve.explicit-re-merge=1 --re-merge --all |
|
467 | 467 | merging file1 |
|
468 | 468 | warning: conflicts while merging file1! (edit, then use 'hg resolve --mark') |
|
469 | 469 | [1] |
|
470 | 470 | |
|
471 | 471 | $ cd .. |
|
472 | 472 | |
|
473 | 473 | ====================================================== |
|
474 | 474 | Test 'hg resolve' confirm config option functionality | |
|
475 | 475 | ====================================================== |
|
476 | 476 | $ cat >> $HGRCPATH << EOF |
|
477 | 477 | > [extensions] |
|
478 | 478 | > rebase= |
|
479 | 479 | > EOF |
|
480 | 480 | |
|
481 | 481 | $ hg init repo2 |
|
482 | 482 | $ cd repo2 |
|
483 | 483 | |
|
484 | 484 | $ echo boss > boss |
|
485 | 485 | $ hg ci -Am "add boss" |
|
486 | 486 | adding boss |
|
487 | 487 | |
|
488 | 488 | $ for emp in emp1 emp2 emp3; do echo work > $emp; done; |
|
489 | 489 | $ hg ci -Aqm "added emp1 emp2 emp3" |
|
490 | 490 | |
|
491 | 491 | $ hg up 0 |
|
492 | 492 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
493 | 493 | |
|
494 | 494 | $ for emp in emp1 emp2 emp3; do echo nowork > $emp; done; |
|
495 | 495 | $ hg ci -Aqm "added lazy emp1 emp2 emp3" |
|
496 | 496 | |
|
497 | 497 | $ hg log -GT "{rev} {node|short} {firstline(desc)}\n" |
|
498 | 498 | @ 2 0acfd4a49af0 added lazy emp1 emp2 emp3 |
|
499 | 499 | | |
|
500 | 500 | | o 1 f30f98a8181f added emp1 emp2 emp3 |
|
501 | 501 | |/ |
|
502 | 502 | o 0 88660038d466 add boss |
|
503 | 503 | |
|
504 | 504 | $ hg rebase -s 1 -d 2 |
|
505 | 505 | rebasing 1:f30f98a8181f "added emp1 emp2 emp3" |
|
506 | 506 | merging emp1 |
|
507 | 507 | merging emp2 |
|
508 | 508 | merging emp3 |
|
509 | 509 | warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark') |
|
510 | 510 | warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark') |
|
511 | 511 | warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark') |
|
512 | 512 | unresolved conflicts (see hg resolve, then hg rebase --continue) |
|
513 | 513 | [1] |
|
514 | 514 | |
|
515 | 515 | Test when commands.resolve.confirm config option is not set: |
|
516 | 516 | =========================================================== |
|
517 | 517 | $ hg resolve --all |
|
518 | 518 | merging emp1 |
|
519 | 519 | merging emp2 |
|
520 | 520 | merging emp3 |
|
521 | 521 | warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark') |
|
522 | 522 | warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark') |
|
523 | 523 | warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark') |
|
524 | 524 | [1] |
|
525 | 525 | |
|
526 | 526 | Test when config option is set: |
|
527 | 527 | ============================== |
|
528 | 528 | $ cat >> $HGRCPATH << EOF |
|
529 | 529 | > [ui] |
|
530 | 530 | > interactive = True |
|
531 | 531 | > [commands] |
|
532 | 532 | > resolve.confirm = True |
|
533 | 533 | > EOF |
|
534 | 534 | |
|
535 | 535 | $ hg resolve |
|
536 | 536 | abort: no files or directories specified |
|
537 | 537 | (use --all to re-merge all unresolved files) |
|
538 | 538 | [255] |
|
539 | 539 | $ hg resolve --all << EOF |
|
540 | 540 | > n |
|
541 | 541 | > EOF |
|
542 | 542 | re-merge all unresolved files (yn)? n |
|
543 | 543 | abort: user quit |
|
544 | 544 | [255] |
|
545 | 545 | |
|
546 | 546 | $ hg resolve --all << EOF |
|
547 | 547 | > y |
|
548 | 548 | > EOF |
|
549 | 549 | re-merge all unresolved files (yn)? y |
|
550 | 550 | merging emp1 |
|
551 | 551 | merging emp2 |
|
552 | 552 | merging emp3 |
|
553 | 553 | warning: conflicts while merging emp1! (edit, then use 'hg resolve --mark') |
|
554 | 554 | warning: conflicts while merging emp2! (edit, then use 'hg resolve --mark') |
|
555 | 555 | warning: conflicts while merging emp3! (edit, then use 'hg resolve --mark') |
|
556 | 556 | [1] |
|
557 | 557 | |
|
558 | 558 | Test that commands.resolve.confirm respect --mark option (only when no patterns args are given): |
|
559 | 559 | =============================================================================================== |
|
560 | 560 | |
|
561 | 561 | $ hg resolve -m emp1 |
|
562 | 562 | $ hg resolve -l |
|
563 | 563 | R emp1 |
|
564 | 564 | U emp2 |
|
565 | 565 | U emp3 |
|
566 | 566 | |
|
567 | 567 | $ hg resolve -m << EOF |
|
568 | 568 | > n |
|
569 | 569 | > EOF |
|
570 | 570 | mark all unresolved files as resolved (yn)? n |
|
571 | 571 | abort: user quit |
|
572 | 572 | [255] |
|
573 | 573 | |
|
574 | 574 | $ hg resolve -m << EOF |
|
575 | 575 | > y |
|
576 | 576 | > EOF |
|
577 | 577 | mark all unresolved files as resolved (yn)? y |
|
578 | 578 | (no more unresolved files) |
|
579 | 579 | continue: hg rebase --continue |
|
580 | 580 | $ hg resolve -l |
|
581 | 581 | R emp1 |
|
582 | 582 | R emp2 |
|
583 | 583 | R emp3 |
|
584 | 584 | |
|
585 | 585 | Test that commands.resolve.confirm respect --unmark option (only when no patterns args are given): |
|
586 | =============================================================================================== | |
|
586 | ================================================================================================= | |
|
587 | 587 | |
|
588 | 588 | $ hg resolve -u emp1 |
|
589 | 589 | |
|
590 | 590 | $ hg resolve -l |
|
591 | 591 | U emp1 |
|
592 | 592 | R emp2 |
|
593 | 593 | R emp3 |
|
594 | 594 | |
|
595 | 595 | $ hg resolve -u << EOF |
|
596 | 596 | > n |
|
597 | 597 | > EOF |
|
598 | 598 | mark all resolved files as unresolved (yn)? n |
|
599 | 599 | abort: user quit |
|
600 | 600 | [255] |
|
601 | 601 | |
|
602 | 602 | $ hg resolve -m << EOF |
|
603 | 603 | > y |
|
604 | 604 | > EOF |
|
605 | 605 | mark all unresolved files as resolved (yn)? y |
|
606 | 606 | (no more unresolved files) |
|
607 | 607 | continue: hg rebase --continue |
|
608 | 608 | |
|
609 | 609 | $ hg resolve -l |
|
610 | 610 | R emp1 |
|
611 | 611 | R emp2 |
|
612 | 612 | R emp3 |
|
613 | 613 | |
|
614 | 614 | $ hg rebase --abort |
|
615 | 615 | rebase aborted |
|
616 | ||
|
617 | Done with commands.resolve.confirm tests: | |
|
616 | 618 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now