Mercurial > hg-stable
changeset 39159:5d3b58472660
filemerge: set actual capabilities of internal merge tools
This information is used to detect actual capabilities of internal
merge tools by subsequent patches.
For convenience, this patch assumes that merge tools typed as
"nomerge" have both binary files and symlinks capabilities.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Tue, 14 Aug 2018 20:08:27 +0900 |
parents | 7c6044634957 |
children | 4d7b11877dd0 |
files | mercurial/filemerge.py mercurial/registrar.py |
diffstat | 2 files changed, 18 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/filemerge.py Tue Aug 14 20:05:36 2018 +0900 +++ b/mercurial/filemerge.py Tue Aug 14 20:08:27 2018 +0900 @@ -470,7 +470,7 @@ success, status = tagmerge.merge(repo, fcd, fco, fca) return success, status, False -@internaltool('dump', fullmerge) +@internaltool('dump', fullmerge, binary=True, symlink=True) def _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): """ Creates three versions of the files to merge, containing the @@ -496,7 +496,7 @@ repo.wwrite(fd + ".base", fca.data(), fca.flags()) return False, 1, False -@internaltool('forcedump', mergeonly) +@internaltool('forcedump', mergeonly, binary=True, symlink=True) def _forcedump(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): """
--- a/mercurial/registrar.py Tue Aug 14 20:05:36 2018 +0900 +++ b/mercurial/registrar.py Tue Aug 14 20:08:27 2018 +0900 @@ -399,7 +399,8 @@ internalmerge = registrar.internalmerge() @internalmerge('mymerge', internalmerge.mergeonly, - onfailure=None, precheck=None): + onfailure=None, precheck=None, + binary=False, symlink=False): def mymergefunc(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None): '''Explanation of this internal merge tool .... @@ -430,6 +431,12 @@ 'files' and 'labels'. If it returns false value, merging is aborted immediately (and file is marked as "unresolved"). + Optional argument 'binary' is a binary files capability of internal + merge tool. 'nomerge' merge type implies binary=True. + + Optional argument 'symlink' is a symlinks capability of inetrnal + merge function. 'nomerge' merge type implies symlink=True. + 'internalmerge' instance in example above can be used to decorate multiple functions. @@ -447,7 +454,14 @@ fullmerge = 'fullmerge' # both premerge and merge def _extrasetup(self, name, func, mergetype, - onfailure=None, precheck=None): + onfailure=None, precheck=None, + binary=False, symlink=False): func.mergetype = mergetype func.onfailure = onfailure func.precheck = precheck + + binarycap = binary or mergetype == self.nomerge + symlinkcap = symlink or mergetype == self.nomerge + + # actual capabilities, which this internal merge tool has + func.capabilities = {"binary": binarycap, "symlink": symlinkcap}