Changeset a598edc9be56…
Parent 24c12bb59d95…
by
Changes to 3 files · Browse files at a598edc9be56 Showing diff from parent 24c12bb59d95 Diff from another changeset...
@@ -1002,14 +1002,8 @@ curvalue = self.get_ini_config(cpath)
if cpath == 'tortoisehg.vdiff':
- # Special case, add extdiff.cmd.* to possible values
- for name, value in self.ui.configitems('extdiff'):
- if name.startswith('cmd.'):
- if name[4:] not in values:
- values.append(name[4:])
- elif not name.startswith('opts.'):
- if name not in values:
- values.append(name)
+ tools = hglib.difftools(self.ui)
+ values.extend(tools.keys())
elif cpath == 'ui.merge':
# Special case, add [merge-tools] to possible values
hglib.mergetools(self.ui, values)
|
@@ -7,12 +7,11 @@
import os
import sys
-import traceback
-import shlib
+import shlex
import time
-from mercurial import hg, ui, util, extensions, commands, hook, match
-from mercurial import dispatch, encoding, templatefilters, bundlerepo, url
+from mercurial import ui, util, extensions, match, bundlerepo, url
+from mercurial import dispatch, encoding, templatefilters
_encoding = encoding.encoding
_encodingmode = encoding.encodingmode
@@ -191,6 +190,36 @@ return values
+def difftools(ui):
+ tools = {}
+ for cmd, path in ui.configitems('extdiff'):
+ if cmd.startswith('cmd.'):
+ cmd = cmd[4:]
+ if not path:
+ path = cmd
+ diffopts = ui.config('extdiff', 'opts.' + cmd, '')
+ diffopts = diffopts and [diffopts] or []
+ tools[cmd] = [path, diffopts]
+ elif cmd.startswith('opts.'):
+ continue
+ else:
+ # command = path opts
+ if path:
+ diffopts = shlex.split(path)
+ path = diffopts.pop(0)
+ else:
+ path, diffopts = cmd, []
+ tools[cmd] = [path, diffopts]
+ mt = []
+ mergetools(ui, mt)
+ for t in mt:
+ if t.startswith('internal:'):
+ continue
+ opts = ui.config('merge-tools', t + '.diffargs', '')
+ tools[t] = [t, shlex.split(opts)]
+ return tools
+
+
def hgcmd_toq(q, *args):
'''
Run an hg command in a background thread, pipe all output to a Queue
@@ -268,4 +297,4 @@ if len(parents) > 1:
return False
- return rev == parents[0].node()
\ No newline at end of file+ return rev == parents[0].node()
|
Loading...