changeset 26606:2a405d307f8c

filemerge: also return whether the merge is complete In future patches, we'll pause merges after the premerge step. After the premerge step we'll return complete = False.
author Siddharth Agarwal <sid0@fb.com>
date Sun, 11 Oct 2015 12:56:21 -0700
parents ef21a2c41629
children 45a6233d5f50
files hgext/largefiles/overrides.py mercurial/filemerge.py mercurial/merge.py
diffstat 3 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Sun Oct 11 12:31:08 2015 -0700
+++ b/hgext/largefiles/overrides.py	Sun Oct 11 12:56:21 2015 -0700
@@ -553,7 +553,7 @@
                (lfutil.splitstandin(orig), ahash, dhash, ohash),
              0) == 1)):
         repo.wwrite(fcd.path(), fco.data(), fco.flags())
-    return 0
+    return True, 0
 
 def copiespathcopies(orig, ctx1, ctx2, match=None):
     copies = orig(ctx1, ctx2, match=match)
--- a/mercurial/filemerge.py	Sun Oct 11 12:31:08 2015 -0700
+++ b/mercurial/filemerge.py	Sun Oct 11 12:56:21 2015 -0700
@@ -443,6 +443,8 @@
     fco = other file context
     fca = ancestor file context
     fcd = local file context for current/destination file
+
+    Returns whether the merge is complete, and the return value of the merge.
     """
 
     if True:
@@ -456,7 +458,7 @@
             return name
 
         if not fco.cmp(fcd): # files identical?
-            return None
+            return True, None
 
         ui = repo.ui
         fd = fcd.path()
@@ -483,7 +485,7 @@
         toolconf = tool, toolpath, binary, symlink
 
         if mergetype == nomerge:
-            return func(repo, mynode, orig, fcd, fco, fca, toolconf)
+            return True, func(repo, mynode, orig, fcd, fco, fca, toolconf)
 
         if orig != fco.path():
             ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd))
@@ -496,7 +498,7 @@
                                      toolconf):
             if onfailure:
                 ui.warn(onfailure % fd)
-            return 1
+            return True, 1
 
         a = repo.wjoin(fd)
         b = temp("base", fca)
@@ -529,7 +531,7 @@
             if onfailure:
                 ui.warn(onfailure % fd)
 
-        return r
+        return True, r
     finally:
         if not r:
             util.unlink(back)
--- a/mercurial/merge.py	Sun Oct 11 12:31:08 2015 -0700
+++ b/mercurial/merge.py	Sun Oct 11 12:56:21 2015 -0700
@@ -310,8 +310,8 @@
         f = self._repo.vfs('merge/' + hash)
         self._repo.wwrite(dfile, f.read(), flags)
         f.close()
-        r = filemerge.filemerge(self._repo, self._local, lfile, fcd, fco, fca,
-                                labels=labels)
+        complete, r = filemerge.filemerge(self._repo, self._local, lfile, fcd,
+                                          fco, fca, labels=labels)
         if r is None:
             # no real conflict
             del self._state[dfile]