Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.7.3, 0.7.4, and 0.7.5

gdialog: support full extdiff settings

Borrow extdiff's code for parsing [extdiff] section to properly
load vdiff options from the user's Mercurial.ini file.

Fixes #125 and probably #126

Changeset 523b97d77588

Parent 85be6017f60d

by Steve Borho

Changes to one file · Browse files at 523b97d77588 Showing diff from parent 85be6017f60d Diff from another changeset...

Change 1 of 4 Show Entire File hggtk/​gdialog.py Stacked
 
22
23
24
 
25
26
27
 
186
187
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
190
191
192
193
194
195
 
196
197
198
 
203
204
205
206
 
207
208
209
210
 
 
211
212
213
 
359
360
361
362
 
363
364
365
 
22
23
24
25
26
27
28
 
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
 
215
216
217
218
 
223
224
225
 
226
227
228
 
 
229
230
231
232
233
 
379
380
381
 
382
383
384
385
@@ -22,6 +22,7 @@
 import gtk  import gobject  import pango +import shlex    from mercurial.i18n import _  from mercurial.node import short @@ -186,13 +187,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 = ''   @@ -203,11 +223,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 @@ -359,7 +379,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':