filemerge: show actual capabilities of internal merge tools
authorFUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Tue, 14 Aug 2018 22:20:28 +0900
changeset 39126 e09fad982ef5
parent 39125 cded904f7acc
child 39127 95bd19f60957
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.
mercurial/filemerge.py
mercurial/help/merge-tools.txt
tests/test-help.t
--- a/mercurial/filemerge.py	Wed Aug 15 22:24:50 2018 +0900
+++ b/mercurial/filemerge.py	Tue Aug 14 22:20:28 2018 +0900
@@ -989,6 +989,12 @@
         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)
 
--- a/mercurial/help/merge-tools.txt	Wed Aug 15 22:24:50 2018 +0900
+++ b/mercurial/help/merge-tools.txt	Tue Aug 14 22:20:28 2018 +0900
@@ -36,8 +36,9 @@
 
 .. 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
 =====================
--- a/tests/test-help.t	Wed Aug 15 22:24:50 2018 +0900
+++ b/tests/test-help.t	Tue Aug 14 22:20:28 2018 +0900
@@ -1829,18 +1829,26 @@
         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 @@
       ":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 @@
         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
       =====================