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)
|
@@ -8,7 +8,6 @@ import gtk
import gobject
import os
-import shlex
import subprocess
import shutil
import tempfile
@@ -102,7 +101,7 @@ _('No repository found here'), None).run()
return
- tools = readtools(repo.ui)
+ tools = hglib.difftools(repo.ui)
preferred = repo.ui.config('tortoisehg', 'vdiff', 'vdiff')
if preferred and preferred in tools:
if len(tools) > 1:
@@ -340,35 +339,6 @@ gdialog.Prompt(_('Tool launch failure'),
_('%s : %s') % (self.diffpath, str(e)), None).run()
-def readtools(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]
- mergetools = []
- hglib.mergetools(ui, mergetools)
- for t in mergetools:
- if t.startswith('internal:'):
- continue
- opts = ui.config('merge-tools', t + '.diffargs', '')
- tools[t] = [t, shlex.split(opts)]
- return tools
-
def rawextdiff(ui, *pats, **opts):
'launch raw extdiff command, block until finish'
from hgext import extdiff
@@ -379,7 +349,7 @@ # hgtk should catch this earlier
ui.warn(_('No repository found here') + '\n')
return
- tools = readtools(ui)
+ tools = hglib.difftools(repo.ui)
preferred = ui.config('tortoisehg', 'vdiff', 'vdiff')
try:
diffcmd, diffopts = tools[preferred]
|
@@ -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...