Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 26621:36383507a6f8
resolve: perform all premerges before performing any file merges (BC)
Just like the BC to merge before it, this allows for a maximally consistent
state before providing any prompts to the user.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Sun, 11 Oct 2015 23:58:07 -0700 |
parents | dfd9811c5c9b |
children | 45b86dbabbda |
comparison
equal
deleted
inserted
replaced
26620:7955127efbcb | 26621:36383507a6f8 |
---|---|
5566 | 5566 |
5567 m = scmutil.match(repo[None], pats, opts) | 5567 m = scmutil.match(repo[None], pats, opts) |
5568 ret = 0 | 5568 ret = 0 |
5569 didwork = False | 5569 didwork = False |
5570 | 5570 |
5571 tocomplete = [] | |
5571 for f in ms: | 5572 for f in ms: |
5572 if not m(f): | 5573 if not m(f): |
5573 continue | 5574 continue |
5574 | 5575 |
5575 didwork = True | 5576 didwork = True |
5584 # backup pre-resolve (merge uses .orig for its own purposes) | 5585 # backup pre-resolve (merge uses .orig for its own purposes) |
5585 a = repo.wjoin(f) | 5586 a = repo.wjoin(f) |
5586 util.copyfile(a, a + ".resolve") | 5587 util.copyfile(a, a + ".resolve") |
5587 | 5588 |
5588 try: | 5589 try: |
5589 # resolve file | 5590 # preresolve file |
5590 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), | 5591 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), |
5591 'resolve') | 5592 'resolve') |
5592 complete, r = ms.preresolve(f, wctx) | 5593 complete, r = ms.preresolve(f, wctx) |
5593 if not complete: | 5594 if not complete: |
5594 r = ms.resolve(f, wctx) | 5595 tocomplete.append(f) |
5595 if r: | 5596 elif r: |
5596 ret = 1 | 5597 ret = 1 |
5597 finally: | 5598 finally: |
5598 ui.setconfig('ui', 'forcemerge', '', 'resolve') | 5599 ui.setconfig('ui', 'forcemerge', '', 'resolve') |
5599 ms.commit() | 5600 ms.commit() |
5600 | 5601 |
5601 # replace filemerge's .orig file with our resolve file | 5602 # replace filemerge's .orig file with our resolve file |
5603 # for files in tocomplete, ms.resolve will not overwrite | |
5604 # .orig -- only preresolve does | |
5602 util.rename(a + ".resolve", a + ".orig") | 5605 util.rename(a + ".resolve", a + ".orig") |
5606 | |
5607 for f in tocomplete: | |
5608 try: | |
5609 # resolve file | |
5610 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), | |
5611 'resolve') | |
5612 r = ms.resolve(f, wctx) | |
5613 if r: | |
5614 ret = 1 | |
5615 finally: | |
5616 ui.setconfig('ui', 'forcemerge', '', 'resolve') | |
5617 ms.commit() | |
5603 | 5618 |
5604 ms.commit() | 5619 ms.commit() |
5605 | 5620 |
5606 if not didwork and pats: | 5621 if not didwork and pats: |
5607 ui.warn(_("arguments do not match paths that need resolving\n")) | 5622 ui.warn(_("arguments do not match paths that need resolving\n")) |