changeset 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 28a6c2d72097
files mercurial/commands.py
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Oct 15 01:27:06 2015 -0700
+++ b/mercurial/commands.py	Thu Oct 15 01:31:04 2015 -0700
@@ -5616,6 +5616,7 @@
         m = scmutil.match(wctx, pats, opts)
         ret = 0
         didwork = False
+        runconclude = False
 
         tocomplete = []
         for f in ms:
@@ -5624,7 +5625,8 @@
 
             didwork = True
 
-            # don't let driver-resolved files be marked
+            # don't let driver-resolved files be marked, and run the conclude
+            # step if asked to resolve
             if ms[f] == "d":
                 exact = m.exact(f)
                 if mark:
@@ -5635,6 +5637,8 @@
                     if exact:
                         ui.warn(_('not unmarking %s as it is driver-resolved\n')
                                 % f)
+                else:
+                    runconclude = True
                 continue
 
             if mark:
@@ -5680,6 +5684,17 @@
 
         if not didwork and pats:
             ui.warn(_("arguments do not match paths that need resolving\n"))
+        elif ms.mergedriver and ms.mdstate() != 's':
+            # run conclude step when either a driver-resolved file is requested
+            # or there are no driver-resolved files
+            # we can't use 'ret' to determine whether any files are unresolved
+            # because we might not have tried to resolve some
+            if ((runconclude or not list(ms.driverresolved()))
+                and not list(ms.unresolved())):
+                proceed = mergemod.driverconclude(repo, ms, wctx)
+                ms.commit()
+                if not proceed:
+                    return 1
 
     finally:
         wlock.release()