changeset 26607:45a6233d5f50

filemerge: introduce a premerge flag and function This flag will let us get to our overall goal of performing all premerges before any merges.
author Siddharth Agarwal <sid0@fb.com>
date Sun, 11 Oct 2015 20:47:04 -0700
parents 2a405d307f8c
children ae5b60d3294f
files hgext/largefiles/overrides.py mercurial/filemerge.py
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Sun Oct 11 12:56:21 2015 -0700
+++ b/hgext/largefiles/overrides.py	Sun Oct 11 20:47:04 2015 -0700
@@ -536,9 +536,11 @@
 
 # Override filemerge to prompt the user about how they wish to merge
 # largefiles. This will handle identical edits without prompting the user.
-def overridefilemerge(origfn, repo, mynode, orig, fcd, fco, fca, labels=None):
+def overridefilemerge(origfn, premerge, repo, mynode, orig, fcd, fco, fca,
+                      labels=None):
     if not lfutil.isstandin(orig):
-        return origfn(repo, mynode, orig, fcd, fco, fca, labels=labels)
+        return origfn(premerge, repo, mynode, orig, fcd, fco, fca,
+                      labels=labels)
 
     ahash = fca.data().strip().lower()
     dhash = fcd.data().strip().lower()
--- a/mercurial/filemerge.py	Sun Oct 11 12:56:21 2015 -0700
+++ b/mercurial/filemerge.py	Sun Oct 11 20:47:04 2015 -0700
@@ -435,9 +435,10 @@
         newlabels.append(_formatconflictmarker(repo, ca, tmpl, labels[2], pad))
     return newlabels
 
-def _filemerge(repo, mynode, orig, fcd, fco, fca, labels=None):
+def _filemerge(premerge, repo, mynode, orig, fcd, fco, fca, labels=None):
     """perform a 3-way merge in the working directory
 
+    premerge = whether this is a premerge
     mynode = parent node before merge
     orig = original local filename before merge
     fco = other file context
@@ -515,7 +516,7 @@
         if markerstyle != 'basic':
             labels = _formatlabels(repo, fcd, fco, fca, labels)
 
-        if mergetype == fullmerge:
+        if premerge and mergetype == fullmerge:
             r = _premerge(repo, toolconf, files, labels=labels)
 
         if not r:  # premerge successfully merged the file
@@ -569,8 +570,13 @@
 
     return r
 
+def premerge(repo, mynode, orig, fcd, fco, fca, labels=None):
+    return _filemerge(True, repo, mynode, orig, fcd, fco, fca, labels=labels)
+
 def filemerge(repo, mynode, orig, fcd, fco, fca, labels=None):
-    return _filemerge(repo, mynode, orig, fcd, fco, fca, labels=labels)
+    # premerge = True is temporary -- will be changed to False once premerge
+    # function above is ready
+    return _filemerge(True, repo, mynode, orig, fcd, fco, fca, labels=labels)
 
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = internals.values()