Patchwork [4,of,6] filemerge.filemerge: exit early if premerge is successful

login
register
mail settings
Submitter Siddharth Agarwal
Date Oct. 9, 2015, 6:46 p.m.
Message ID <8c8b25e411786aaba611.1444416371@dev6666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/10924/
State Accepted
Headers show

Comments

Siddharth Agarwal - Oct. 9, 2015, 6:46 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1444343626 25200
#      Thu Oct 08 15:33:46 2015 -0700
# Node ID 8c8b25e411786aaba611a00fe3882f783e1c592c
# Parent  9d37da98fac061179cd1f8215cafe1c119c7e8f1
filemerge.filemerge: exit early if premerge is successful

Higher level functions will be able to use this as a signal that the merge has
completed.

Patch

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -526,13 +526,13 @@  def filemerge(repo, mynode, orig, fcd, f
         if mergetype == fullmerge:
             r = _premerge(repo, toolconf, files, labels=labels)
 
+        if not r:
+            raise StopIteration(r)
+
         yield
 
-        if not r:  # premerge successfully merged the file
-            needcheck = False
-        else:
-            needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf,
-                                files, labels=labels)
+        needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf, files,
+                            labels=labels)
 
         if needcheck:
             r = _check(r, ui, tool, fcd, files)