changeset 26786:121f80d14e4b

merge.applyupdates: call driverpreprocess before starting merge actions We also need to update our internal state to whatever state driverpreprocess leaves it in. Adding an error state separate from the unresolved count is too big a refactoring for now, so we hack around it by setting it to a positive value to indicate an error state.
author Siddharth Agarwal <sid0@fb.com>
date Thu, 15 Oct 2015 01:19:10 -0700
parents e9a0d5f5c225
children 64848559413a
files mercurial/merge.py
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Thu Oct 15 01:17:29 2015 -0700
+++ b/mercurial/merge.py	Thu Oct 15 01:19:10 2015 -0700
@@ -942,6 +942,27 @@
         util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags)
         updated += 1
 
+    mergeactions = actions['m']
+    # the ordering is important here -- ms.mergedriver will raise if the merge
+    # driver has changed, and we want to be able to bypass it when overwrite is
+    # True
+    usemergedriver = not overwrite and mergeactions and ms.mergedriver
+
+    if usemergedriver:
+        ms.commit()
+        proceed = driverpreprocess(repo, ms, wctx, labels=labels)
+        # the driver might leave some files unresolved
+        unresolvedf = set(ms.unresolved())
+        if not proceed:
+            # XXX setting unresolved to at least 1 is a hack to make sure we
+            # error out
+            return updated, merged, removed, max(len(unresolvedf), 1)
+        newactions = []
+        for f, args, msg in mergeactions:
+            if f in unresolvedf:
+                newactions.append((f, args, msg))
+        mergeactions = newactions
+
     # premerge
     tocomplete = []
     for f, args, msg in actions['m']: