##// END OF EJS Templates
Improve extdiff configuration....
Brendan Cully -
r5245:a1efa71f default
parent child Browse files
Show More
@@ -4,55 +4,51 b''
4 4 #
5 5 # This software may be used and distributed according to the terms
6 6 # of the GNU General Public License, incorporated herein by reference.
7 #
8 # The `extdiff' Mercurial extension allows you to use external programs
9 # to compare revisions, or revision with working dir. The external diff
10 # programs are called with a configurable set of options and two
11 # non-option arguments: paths to directories containing snapshots of
12 # files to compare.
13 #
14 # To enable this extension:
15 #
16 # [extensions]
17 # hgext.extdiff =
18 #
19 # The `extdiff' extension also allows to configure new diff commands, so
20 # you do not need to type "hg extdiff -p kdiff3" always.
21 #
22 # [extdiff]
23 # # add new command that runs GNU diff(1) in 'context diff' mode
24 # cmd.cdiff = gdiff
25 # opts.cdiff = -Nprc5
7
8 '''
9 The `extdiff' Mercurial extension allows you to use external programs
10 to compare revisions, or revision with working dir. The external diff
11 programs are called with a configurable set of options and two
12 non-option arguments: paths to directories containing snapshots of
13 files to compare.
14
15 To enable this extension:
16
17 [extensions]
18 hgext.extdiff =
19
20 The `extdiff' extension also allows to configure new diff commands, so
21 you do not need to type "hg extdiff -p kdiff3" always.
26 22
27 # # add new command called vdiff, runs kdiff3
28 # cmd.vdiff = kdiff3
23 [extdiff]
24 # add new command that runs GNU diff(1) in 'context diff' mode
25 cdiff = gdiff -Nprc5
26 ## or the old way:
27 #cmd.cdiff = gdiff
28 #opts.cdiff = -Nprc5
29 29
30 # # add new command called meld, runs meld (no need to name twice)
31 # cmd.meld =
30 # add new command called vdiff, runs kdiff3
31 vdiff = kdiff3
32 32
33 # # add new command called vimdiff, runs gvimdiff with DirDiff plugin
34 # #(see http://www.vim.org/scripts/script.php?script_id=102)
35 # # Non english user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
36 # # your .vimrc
37 # cmd.vimdiff = gvim
38 # opts.vimdiff = -f '+next' '+execute "DirDiff" argv(0) argv(1)'
39 #
40 # Each custom diff commands can have two parts: a `cmd' and an `opts'
41 # part. The cmd.xxx option defines the name of an executable program
42 # that will be run, and opts.xxx defines a set of command-line options
43 # which will be inserted to the command between the program name and
44 # the files/directories to diff (i.e. the cdiff example above).
45 #
46 # You can use -I/-X and list of file or directory names like normal
47 # "hg diff" command. The `extdiff' extension makes snapshots of only
48 # needed files, so running the external diff program will actually be
49 # pretty fast (at least faster than having to compare the entire tree).
33 # add new command called meld, runs meld (no need to name twice)
34 meld =
35
36 # add new command called vimdiff, runs gvimdiff with DirDiff plugin
37 #(see http://www.vim.org/scripts/script.php?script_id=102)
38 # Non english user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
39 # your .vimrc
40 vimdiff = gvim -f '+next' '+execute "DirDiff" argv(0) argv(1)'
41
42 You can use -I/-X and list of file or directory names like normal
43 "hg diff" command. The `extdiff' extension makes snapshots of only
44 needed files, so running the external diff program will actually be
45 pretty fast (at least faster than having to compare the entire tree).
46 '''
50 47
51 48 from mercurial.i18n import _
52 49 from mercurial.node import *
53 50 from mercurial import cmdutil, util, commands
54 import os, shutil, tempfile
55
51 import os, shlex, shutil, tempfile
56 52
57 53 def snapshot_node(ui, repo, files, node, tmproot):
58 54 '''snapshot files as of some revision'''
@@ -187,11 +183,20 b' cmdtable = {'
187 183
188 184 def uisetup(ui):
189 185 for cmd, path in ui.configitems('extdiff'):
190 if not cmd.startswith('cmd.'): continue
191 cmd = cmd[4:]
192 if not path: path = cmd
193 diffopts = ui.config('extdiff', 'opts.' + cmd, '')
194 diffopts = diffopts and [diffopts] or []
186 if cmd.startswith('cmd.'):
187 cmd = cmd[4:]
188 if not path: path = cmd
189 diffopts = ui.config('extdiff', 'opts.' + cmd, '')
190 diffopts = diffopts and [diffopts] or []
191 elif cmd.startswith('opts.'):
192 continue
193 else:
194 # command = path opts
195 if path:
196 diffopts = shlex.split(path)
197 path = diffopts.pop(0)
198 else:
199 path, diffopts = cmd, []
195 200 def save(cmd, path, diffopts):
196 201 '''use closure to save diff command to use'''
197 202 def mydiff(ui, repo, *pats, **opts):
General Comments 0
You need to be logged in to leave comments. Login now