hgext/extdiff.py
changeset 23150 aff73c777b0b
parent 23149 dc80a0ad7bf5
child 23151 733d980b9c59
equal deleted inserted replaced
23149:dc80a0ad7bf5 23150:aff73c777b0b
    24   #opts.cdiff = -Nprc5
    24   #opts.cdiff = -Nprc5
    25 
    25 
    26   # add new command called vdiff, runs kdiff3
    26   # add new command called vdiff, runs kdiff3
    27   vdiff = kdiff3
    27   vdiff = kdiff3
    28 
    28 
    29   # add new command called meld, runs meld (no need to name twice)
    29   # add new command called meld, runs meld (no need to name twice).  If
       
    30   # the meld executable is not available, the meld tool in [merge-tools]
       
    31   # will be used, if available
    30   meld =
    32   meld =
    31 
    33 
    32   # add new command called vimdiff, runs gvimdiff with DirDiff plugin
    34   # add new command called vimdiff, runs gvimdiff with DirDiff plugin
    33   # (see http://www.vim.org/scripts/script.php?script_id=102) Non
    35   # (see http://www.vim.org/scripts/script.php?script_id=102) Non
    34   # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
    36   # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
    61 pretty fast (at least faster than having to compare the entire tree).
    63 pretty fast (at least faster than having to compare the entire tree).
    62 '''
    64 '''
    63 
    65 
    64 from mercurial.i18n import _
    66 from mercurial.i18n import _
    65 from mercurial.node import short, nullid
    67 from mercurial.node import short, nullid
    66 from mercurial import cmdutil, scmutil, util, commands, encoding
    68 from mercurial import cmdutil, scmutil, util, commands, encoding, filemerge
    67 import os, shlex, shutil, tempfile, re
    69 import os, shlex, shutil, tempfile, re
    68 
    70 
    69 cmdtable = {}
    71 cmdtable = {}
    70 command = cmdutil.command(cmdtable)
    72 command = cmdutil.command(cmdtable)
    71 testedwith = 'internal'
    73 testedwith = 'internal'
   277 def uisetup(ui):
   279 def uisetup(ui):
   278     for cmd, path in ui.configitems('extdiff'):
   280     for cmd, path in ui.configitems('extdiff'):
   279         if cmd.startswith('cmd.'):
   281         if cmd.startswith('cmd.'):
   280             cmd = cmd[4:]
   282             cmd = cmd[4:]
   281             if not path:
   283             if not path:
   282                 path = cmd
   284                 path = util.findexe(cmd)
       
   285                 if path is None:
       
   286                     path = filemerge.findexternaltool(ui, cmd) or cmd
   283             diffopts = ui.config('extdiff', 'opts.' + cmd, '')
   287             diffopts = ui.config('extdiff', 'opts.' + cmd, '')
   284             diffopts = diffopts and [diffopts] or []
   288             diffopts = diffopts and [diffopts] or []
   285         elif cmd.startswith('opts.'):
   289         elif cmd.startswith('opts.'):
   286             continue
   290             continue
   287         else:
   291         else:
   288             # command = path opts
   292             # command = path opts
   289             if path:
   293             if path:
   290                 diffopts = shlex.split(path)
   294                 diffopts = shlex.split(path)
   291                 path = diffopts.pop(0)
   295                 path = diffopts.pop(0)
   292             else:
   296             else:
   293                 path, diffopts = cmd, []
   297                 path, diffopts = util.findexe(cmd), []
       
   298                 if path is None:
       
   299                     path = filemerge.findexternaltool(ui, cmd) or cmd
   294         # look for diff arguments in [diff-tools] then [merge-tools]
   300         # look for diff arguments in [diff-tools] then [merge-tools]
   295         if diffopts == []:
   301         if diffopts == []:
   296             args = ui.config('diff-tools', cmd+'.diffargs') or \
   302             args = ui.config('diff-tools', cmd+'.diffargs') or \
   297                    ui.config('merge-tools', cmd+'.diffargs')
   303                    ui.config('merge-tools', cmd+'.diffargs')
   298             if args:
   304             if args: