Patchwork [3,of,9,mergedriver] filemerge: add a before-merge callback to internal merge tools

login
register
mail settings
Submitter Siddharth Agarwal
Date Oct. 7, 2015, 7:33 a.m.
Message ID <d742ca75b75ab951f6c0.1444203218@dev6666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/10844/
State Accepted
Headers show

Comments

Siddharth Agarwal - Oct. 7, 2015, 7:33 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1444197254 25200
#      Tue Oct 06 22:54:14 2015 -0700
# Node ID d742ca75b75ab951f6c05b7e0e24cc6e58eecf96
# Parent  3225fccf647a4c45e86b84746a1768ef408e96c7
filemerge: add a before-merge callback to internal merge tools

We're going to separate the pre-merge and merge steps for merge tools. The
merge step will be specific to the tool, but the pre-merge step will be common
to all merge tools that need it.

However, some merge tools run checks *before* the pre-merge step. This callback
will allow that to continue to work.

Patch

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -38,7 +38,7 @@  internals = {}
 # Merge tools to document.
 internalsdoc = {}
 
-def internaltool(name, trymerge, onfailure=None):
+def internaltool(name, trymerge, onfailure=None, precheck=None):
     '''return a decorator for populating internal merge tool table'''
     def decorator(func):
         fullname = ':' + name
@@ -48,6 +48,7 @@  def internaltool(name, trymerge, onfailu
         internalsdoc[fullname] = func
         func.trymerge = trymerge
         func.onfailure = onfailure
+        func.precheck = precheck
         return func
     return decorator