Show More
@@ -4961,7 +4961,6 b' def resolve(ui, repo, *pats, **opts):' | |||||
4961 | ms.mark(f, "u") |
|
4961 | ms.mark(f, "u") | |
4962 | else: |
|
4962 | else: | |
4963 | wctx = repo[None] |
|
4963 | wctx = repo[None] | |
4964 | mctx = wctx.parents()[-1] |
|
|||
4965 |
|
4964 | |||
4966 | # backup pre-resolve (merge uses .orig for its own purposes) |
|
4965 | # backup pre-resolve (merge uses .orig for its own purposes) | |
4967 | a = repo.wjoin(f) |
|
4966 | a = repo.wjoin(f) | |
@@ -4970,7 +4969,7 b' def resolve(ui, repo, *pats, **opts):' | |||||
4970 | try: |
|
4969 | try: | |
4971 | # resolve file |
|
4970 | # resolve file | |
4972 | ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) |
|
4971 | ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) | |
4973 |
if ms.resolve(f, wctx |
|
4972 | if ms.resolve(f, wctx): | |
4974 | ret = 1 |
|
4973 | ret = 1 | |
4975 | finally: |
|
4974 | finally: | |
4976 | ui.setconfig('ui', 'forcemerge', '') |
|
4975 | ui.setconfig('ui', 'forcemerge', '') |
@@ -186,11 +186,12 b' class mergestate(object):' | |||||
186 | def mark(self, dfile, state): |
|
186 | def mark(self, dfile, state): | |
187 | self._state[dfile][0] = state |
|
187 | self._state[dfile][0] = state | |
188 | self._dirty = True |
|
188 | self._dirty = True | |
189 |
def resolve(self, dfile, wctx |
|
189 | def resolve(self, dfile, wctx): | |
190 | if self[dfile] == 'r': |
|
190 | if self[dfile] == 'r': | |
191 | return 0 |
|
191 | return 0 | |
192 | stateentry = self._state[dfile] |
|
192 | stateentry = self._state[dfile] | |
193 | state, hash, lfile, afile, anode, ofile, onode, flags = stateentry |
|
193 | state, hash, lfile, afile, anode, ofile, onode, flags = stateentry | |
|
194 | octx = self._repo[self._other] | |||
194 | fcd = wctx[dfile] |
|
195 | fcd = wctx[dfile] | |
195 | fco = octx[ofile] |
|
196 | fco = octx[ofile] | |
196 | fca = self._repo.filectx(afile, fileid=anode) |
|
197 | fca = self._repo.filectx(afile, fileid=anode) | |
@@ -641,7 +642,7 b' def applyupdates(repo, actions, wctx, mc' | |||||
641 | overwrite) |
|
642 | overwrite) | |
642 | continue |
|
643 | continue | |
643 | audit(fd) |
|
644 | audit(fd) | |
644 |
r = ms.resolve(fd, wctx |
|
645 | r = ms.resolve(fd, wctx) | |
645 | if r is not None and r > 0: |
|
646 | if r is not None and r > 0: | |
646 | unresolved += 1 |
|
647 | unresolved += 1 | |
647 | else: |
|
648 | else: |
@@ -408,3 +408,93 b' on branch1, so no file1 and file2:' | |||||
408 | update: (current) |
|
408 | update: (current) | |
409 |
|
409 | |||
410 | $ cd .. |
|
410 | $ cd .. | |
|
411 | ||||
|
412 | ||||
|
413 | Test usage of `hg resolve` in case of conflict | |||
|
414 | (issue4163) | |||
|
415 | ||||
|
416 | $ hg init issue4163 | |||
|
417 | $ cd issue4163 | |||
|
418 | $ touch foo | |||
|
419 | $ hg add foo | |||
|
420 | $ cat > foo << EOF | |||
|
421 | > one | |||
|
422 | > two | |||
|
423 | > three | |||
|
424 | > four | |||
|
425 | > five | |||
|
426 | > six | |||
|
427 | > seven | |||
|
428 | > height | |||
|
429 | > nine | |||
|
430 | > ten | |||
|
431 | > EOF | |||
|
432 | $ hg ci -m 'initial' | |||
|
433 | $ cat > foo << EOF | |||
|
434 | > one | |||
|
435 | > two | |||
|
436 | > THREE | |||
|
437 | > four | |||
|
438 | > five | |||
|
439 | > six | |||
|
440 | > seven | |||
|
441 | > height | |||
|
442 | > nine | |||
|
443 | > ten | |||
|
444 | > EOF | |||
|
445 | $ hg ci -m 'capital three' | |||
|
446 | $ cat > foo << EOF | |||
|
447 | > one | |||
|
448 | > two | |||
|
449 | > THREE | |||
|
450 | > four | |||
|
451 | > five | |||
|
452 | > six | |||
|
453 | > seven | |||
|
454 | > height | |||
|
455 | > nine | |||
|
456 | > TEN | |||
|
457 | > EOF | |||
|
458 | $ hg ci -m 'capital ten' | |||
|
459 | $ hg backout -r 'desc("capital three")' --tool internal:fail | |||
|
460 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |||
|
461 | use 'hg resolve' to retry unresolved file merges | |||
|
462 | [1] | |||
|
463 | $ hg status | |||
|
464 | $ hg resolve -l # still unresolved | |||
|
465 | U foo | |||
|
466 | $ hg summary | |||
|
467 | parent: 2:b71750c4b0fd tip | |||
|
468 | capital ten | |||
|
469 | branch: default | |||
|
470 | commit: 1 unresolved (clean) | |||
|
471 | update: (current) | |||
|
472 | $ hg resolve --all --debug | |||
|
473 | picked tool 'internal:merge' for foo (binary False symlink False) | |||
|
474 | merging foo | |||
|
475 | my foo@b71750c4b0fd+ other foo@a30dd8addae3 ancestor foo@913609522437 | |||
|
476 | premerge successful | |||
|
477 | $ hg status | |||
|
478 | M foo | |||
|
479 | ? foo.orig | |||
|
480 | $ hg resolve -l | |||
|
481 | R foo | |||
|
482 | $ hg summary | |||
|
483 | parent: 2:b71750c4b0fd tip | |||
|
484 | capital ten | |||
|
485 | branch: default | |||
|
486 | commit: 1 modified, 1 unknown | |||
|
487 | update: (current) | |||
|
488 | $ cat foo | |||
|
489 | one | |||
|
490 | two | |||
|
491 | three | |||
|
492 | four | |||
|
493 | five | |||
|
494 | six | |||
|
495 | seven | |||
|
496 | height | |||
|
497 | nine | |||
|
498 | TEN | |||
|
499 | ||||
|
500 |
General Comments 0
You need to be logged in to leave comments.
Login now