# HG changeset patch # User FUJIWARA Katsunori # Date 2018-08-14 13:20:28 # Node ID e09fad982ef51d01f52505a00805ac079bd76df5 # Parent cded904f7acc90b50e00e4cd76281bda5cfb2535 filemerge: show actual capabilities of internal merge tools This information is useful to know which internal merge tools can be applied safely on binary files and/or symlinks. diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -989,6 +989,12 @@ def loadinternalmerge(ui, extname, regis internals['internal:' + name] = func internalsdoc[fullname] = func + capabilities = sorted([k for k, v in func.capabilities.items() if v]) + if capabilities: + capdesc = _("(actual capabilities: %s)") % ', '.join(capabilities) + func.__doc__ = (func.__doc__ + + pycompat.sysstr("\n\n %s" % capdesc)) + # load built-in merge tools explicitly to setup internalsdoc loadinternalmerge(None, None, internaltool) diff --git a/mercurial/help/merge-tools.txt b/mercurial/help/merge-tools.txt --- a/mercurial/help/merge-tools.txt +++ b/mercurial/help/merge-tools.txt @@ -36,8 +36,9 @@ merge tools are: .. internaltoolsmarker -Internal tools are always available and do not require a GUI but will by default -not handle symlinks or binary files. +Internal tools are always available and do not require a GUI but will +by default not handle symlinks or binary files. See next section for +detail about "actual capabilities" described above. Choosing a merge tool ===================== diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -1829,18 +1829,26 @@ Test dynamic list of merge tools only sh This implies premerge. Therefore, files aren't dumped, if premerge runs successfully. Use :forcedump to forcibly write files out. + (actual capabilities: binary, symlink) + ":fail" Rather than attempting to merge files that were modified on both branches, it marks them as unresolved. The resolve command must be used to resolve these conflicts. + (actual capabilities: binary, symlink) + ":forcedump" Creates three versions of the files as same as :dump, but omits premerge. + (actual capabilities: binary, symlink) + ":local" Uses the local 'p1()' version of files as the merged version. + (actual capabilities: binary, symlink) + ":merge" Uses the internal non-interactive simple merge algorithm for merging files. It will fail if there are any conflicts and leave markers in the @@ -1864,10 +1872,14 @@ Test dynamic list of merge tools only sh ":other" Uses the other 'p2()' version of files as the merged version. + (actual capabilities: binary, symlink) + ":prompt" Asks the user which of the local 'p1()' or the other 'p2()' version to keep as the merged version. + (actual capabilities: binary, symlink) + ":tagmerge" Uses the internal tag merge algorithm (experimental). @@ -1877,7 +1889,8 @@ Test dynamic list of merge tools only sh markers are inserted. Internal tools are always available and do not require a GUI but will by - default not handle symlinks or binary files. + default not handle symlinks or binary files. See next section for detail + about "actual capabilities" described above. Choosing a merge tool =====================