Patchwork [4,of,5,mergedriver] commands.resolve: conclude merges after starting them

login
register
mail settings
Submitter Siddharth Agarwal
Date Oct. 9, 2015, 11:10 p.m.
Message ID <ff24df65dfb8265cc2e3.1444432223@dev6666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/10941/
State Changes Requested
Headers show

Comments

Siddharth Agarwal - Oct. 9, 2015, 11:10 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1444431538 25200
#      Fri Oct 09 15:58:58 2015 -0700
# Node ID ff24df65dfb8265cc2e328ec6d27c3b034421c99
# Parent  144c1acf2dec19143571877f89ccb5efb1fe18c4
commands.resolve: conclude merges after starting them

We set ret to 1 if the premerge for any considered file failed outright, or if
it was paused and then the merge failed.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5567,6 +5567,8 @@  def resolve(ui, repo, *pats, **opts):
         ret = 0
         didwork = False
 
+        premerge = {}
+
         for f in ms:
             if not m(f):
                 continue
@@ -5588,8 +5590,7 @@  def resolve(ui, repo, *pats, **opts):
                     # resolve file
                     ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
                                  'resolve')
-                    if ms.resolve(f, wctx):
-                        ret = 1
+                    premerge[f] = ms.resolve(f, wctx)
                 finally:
                     ui.setconfig('ui', 'forcemerge', '', 'resolve')
                     ms.commit()
@@ -5597,8 +5598,15 @@  def resolve(ui, repo, *pats, **opts):
                 # replace filemerge's .orig file with our resolve file
                 util.rename(a + ".resolve", a + ".orig")
 
+        mergeres = ms.concludemerges()
         ms.commit()
 
+        # scan for any merges that aren't resolved
+        for f, r in premerge.iteritems():
+            if r and mergeres.get(f, 1):
+                ret = 1
+                break
+
         if not didwork and pats:
             ui.warn(_("arguments do not match paths that need resolving\n"))