Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 26789:e6003ecf3257
commands.resolve: conclude merge driver if no unresolved files are left
This can happen when either 'hg resolve --all' is called or a driver-resolved
file is explicitly requested.
This is done as part of 'hg resolve --all' so that users still have a chance to
test their changes before committing them.
The exact semantics here are still to be decided. This does not impact any
non-experimental features.
Thanks to Pierre-Yves David for some advice about this behavior in particular,
and merge drivers in general.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Thu, 15 Oct 2015 01:31:04 -0700 |
parents | d773150d71f2 |
children | 13b861d1cce9 |
comparison
equal
deleted
inserted
replaced
26788:d773150d71f2 | 26789:e6003ecf3257 |
---|---|
5614 return 1 | 5614 return 1 |
5615 | 5615 |
5616 m = scmutil.match(wctx, pats, opts) | 5616 m = scmutil.match(wctx, pats, opts) |
5617 ret = 0 | 5617 ret = 0 |
5618 didwork = False | 5618 didwork = False |
5619 runconclude = False | |
5619 | 5620 |
5620 tocomplete = [] | 5621 tocomplete = [] |
5621 for f in ms: | 5622 for f in ms: |
5622 if not m(f): | 5623 if not m(f): |
5623 continue | 5624 continue |
5624 | 5625 |
5625 didwork = True | 5626 didwork = True |
5626 | 5627 |
5627 # don't let driver-resolved files be marked | 5628 # don't let driver-resolved files be marked, and run the conclude |
5629 # step if asked to resolve | |
5628 if ms[f] == "d": | 5630 if ms[f] == "d": |
5629 exact = m.exact(f) | 5631 exact = m.exact(f) |
5630 if mark: | 5632 if mark: |
5631 if exact: | 5633 if exact: |
5632 ui.warn(_('not marking %s as it is driver-resolved\n') | 5634 ui.warn(_('not marking %s as it is driver-resolved\n') |
5633 % f) | 5635 % f) |
5634 elif unmark: | 5636 elif unmark: |
5635 if exact: | 5637 if exact: |
5636 ui.warn(_('not unmarking %s as it is driver-resolved\n') | 5638 ui.warn(_('not unmarking %s as it is driver-resolved\n') |
5637 % f) | 5639 % f) |
5640 else: | |
5641 runconclude = True | |
5638 continue | 5642 continue |
5639 | 5643 |
5640 if mark: | 5644 if mark: |
5641 ms.mark(f, "r") | 5645 ms.mark(f, "r") |
5642 elif unmark: | 5646 elif unmark: |
5678 | 5682 |
5679 ms.commit() | 5683 ms.commit() |
5680 | 5684 |
5681 if not didwork and pats: | 5685 if not didwork and pats: |
5682 ui.warn(_("arguments do not match paths that need resolving\n")) | 5686 ui.warn(_("arguments do not match paths that need resolving\n")) |
5687 elif ms.mergedriver and ms.mdstate() != 's': | |
5688 # run conclude step when either a driver-resolved file is requested | |
5689 # or there are no driver-resolved files | |
5690 # we can't use 'ret' to determine whether any files are unresolved | |
5691 # because we might not have tried to resolve some | |
5692 if ((runconclude or not list(ms.driverresolved())) | |
5693 and not list(ms.unresolved())): | |
5694 proceed = mergemod.driverconclude(repo, ms, wctx) | |
5695 ms.commit() | |
5696 if not proceed: | |
5697 return 1 | |
5683 | 5698 |
5684 finally: | 5699 finally: |
5685 wlock.release() | 5700 wlock.release() |
5686 | 5701 |
5687 # Nudge users into finishing an unfinished operation | 5702 # Nudge users into finishing an unfinished operation |