comparison mercurial/filemerge.py @ 26513:01224c28e0ed

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.
author Siddharth Agarwal <sid0@fb.com>
date Tue, 06 Oct 2015 22:54:14 -0700
parents 4c52dd406adc
children d5d8cd0e0d58
comparison
equal deleted inserted replaced
26512:4c52dd406adc 26513:01224c28e0ed
36 36
37 internals = {} 37 internals = {}
38 # Merge tools to document. 38 # Merge tools to document.
39 internalsdoc = {} 39 internalsdoc = {}
40 40
41 def internaltool(name, trymerge, onfailure=None): 41 def internaltool(name, trymerge, onfailure=None, precheck=None):
42 '''return a decorator for populating internal merge tool table''' 42 '''return a decorator for populating internal merge tool table'''
43 def decorator(func): 43 def decorator(func):
44 fullname = ':' + name 44 fullname = ':' + name
45 func.__doc__ = "``%s``\n" % fullname + func.__doc__.strip() 45 func.__doc__ = "``%s``\n" % fullname + func.__doc__.strip()
46 internals[fullname] = func 46 internals[fullname] = func
47 internals['internal:' + name] = func 47 internals['internal:' + name] = func
48 internalsdoc[fullname] = func 48 internalsdoc[fullname] = func
49 func.trymerge = trymerge 49 func.trymerge = trymerge
50 func.onfailure = onfailure 50 func.onfailure = onfailure
51 func.precheck = precheck
51 return func 52 return func
52 return decorator 53 return decorator
53 54
54 def _findtool(ui, tool): 55 def _findtool(ui, tool):
55 if tool in internals: 56 if tool in internals: