by
Changes to 3 files · Browse files at ebaeb63a444a Showing diff from parent 60017f91de5b 944b5a53b1e3 Diff from another changeset...
@@ -11,6 +11,7 @@ import gtk
import gobject
import pango
+import shlex
import os
import threading
@@ -181,13 +182,32 @@ def test_opt(self, opt):
return opt in self.opts and self.opts[opt]
+ def _parse_extdiff_cmd(self, usercmd):
+ for cmd, path in self.ui.configitems('extdiff'):
+ if cmd.startswith('cmd.'):
+ cmd = cmd[4:]
+ if cmd != usercmd:
+ continue
+ if not path:
+ path = cmd
+ diffopts = self.ui.config('extdiff', 'opts.' + cmd, '')
+ diffopts = diffopts and [diffopts] or []
+ elif cmd == usercmd:
+ # command = path opts
+ if path:
+ diffopts = shlex.split(path)
+ path = diffopts.pop(0)
+ else:
+ path, diffopts = cmd, []
+ return path, diffopts
+ return None, None
def _parse_config(self):
# defaults
self.fontcomment = 'monospace 10'
self.fontdiff = 'monospace 10'
self.fontlist = 'monospace 9'
- self.diffopts = ''
+ self.diffopts = []
self.diffcmd = ''
self.diffbottom = ''
@@ -198,11 +218,11 @@ # default to tortoisehg's configuration
vdiff = self.ui.config('tortoisehg', 'vdiff', 'vdiff')
if vdiff:
- self.diffcmd = self.ui.config('extdiff', 'cmd.'+vdiff) or vdiff
+ self.diffcmd, self.diffopts = self._parse_extdiff_cmd(vdiff)
else:
self.diffcmd = 'diff'
- if not self.diffopts :
- self.diffopts = '-Npru'
+ if not self.diffopts:
+ self.diffopts = ['-Npru']
if not self.diffbottom:
self.diffbottom = False
@@ -354,7 +374,7 @@
def _diff_file(self, stat, file):
def dodiff():
- extdiff.dodiff(self.ui, self.repo, self.diffcmd, [self.diffopts],
+ extdiff.dodiff(self.ui, self.repo, self.diffcmd, self.diffopts,
[self.repo.wjoin(file)], self.opts)
if self.diffcmd == 'diff':
|
@@ -136,10 +136,13 @@ histlist.append(cs)
cs = {}
else:
- name, value = re.split(':\s+', x, 1)
- if name not in cs:
- cs[name] = []
- cs[name].append(hglib.toutf(value))
+ try:
+ name, value = re.split(':\s+', x, 1)
+ if name not in cs:
+ cs[name] = []
+ cs[name].append(hglib.toutf(value))
+ except ValueError:
+ pass
if cs:
histlist.append(cs)
|
Loading...