hgext/extdiff.py
changeset 2901 05f357b70cb0
parent 2891 453097750fbf
child 2959 7f5fc4b347de
equal deleted inserted replaced
2897:8fd6925ae32f 2901:05f357b70cb0
     3 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
     3 # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com>
     4 #
     4 #
     5 # This software may be used and distributed according to the terms
     5 # This software may be used and distributed according to the terms
     6 # of the GNU General Public License, incorporated herein by reference.
     6 # of the GNU General Public License, incorporated herein by reference.
     7 #
     7 #
     8 # allow to use external programs to compare revisions, or revision
     8 # The `extdiff' Mercurial extension allows you to use external programs
     9 # with working dir. program is called with two arguments: paths to
     9 # to compare revisions, or revision with working dir.  The external diff
    10 # directories containing snapshots of files to compare.
    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.
    11 #
    13 #
    12 # to enable:
    14 # To enable this extension:
    13 #
    15 #
    14 #   [extensions]
    16 #   [extensions]
    15 #   hgext.extdiff =
    17 #   hgext.extdiff =
    16 #
    18 #
    17 # also allows to configure new diff commands, so you do not need to
    19 # The `extdiff' extension also allows to configure new diff commands, so
    18 # type "hg extdiff -p kdiff3" always.
    20 # you do not need to type "hg extdiff -p kdiff3" always.
    19 #
    21 #
    20 #   [extdiff]
    22 #   [extdiff]
       
    23 #   # add new command that runs GNU diff(1) in 'context diff' mode
       
    24 #   cmd.cdiff = gdiff
       
    25 #   opts.cdiff = -Nprc5
    21 #   # add new command called vdiff, runs kdiff3
    26 #   # add new command called vdiff, runs kdiff3
    22 #   cmd.vdiff = kdiff3
    27 #   cmd.vdiff = kdiff3
    23 #   # add new command called meld, runs meld (no need to name twice)
    28 #   # add new command called meld, runs meld (no need to name twice)
    24 #   cmd.meld =
    29 #   cmd.meld =
    25 #   # add new command called vimdiff, runs gvimdiff with DirDiff plugin
    30 #   # add new command called vimdiff, runs gvimdiff with DirDiff plugin
    26 #   #(see http://www.vim.org/scripts/script.php?script_id=102)
    31 #   #(see http://www.vim.org/scripts/script.php?script_id=102)
    27 #   cmd.vimdiff = LC_ALL=C gvim -f '+bdel 1 2' '+ execute "DirDiff ".argv(0)." ".argv(1)'
    32 #   cmd.vimdiff = LC_ALL=C gvim -f '+bdel 1 2' '+ execute "DirDiff ".argv(0)." ".argv(1)'
    28 #
    33 #
    29 # you can use -I/-X and list of file or directory names like normal
    34 # Each custom diff commands can have two parts: a `cmd' and an `opts'
    30 # "hg diff" command. extdiff makes snapshots of only needed files, so
    35 # part.  The cmd.xxx option defines the name of an executable program
    31 # compare program will be fast.
    36 # that will be run, and opts.xxx defines a set of command-line options
       
    37 # which will be inserted to the command between the program name and
       
    38 # the files/directories to diff (i.e. the cdiff example above).
       
    39 #
       
    40 # You can use -I/-X and list of file or directory names like normal
       
    41 # "hg diff" command.  The `extdiff' extension makes snapshots of only
       
    42 # needed files, so running the external diff program will actually be
       
    43 # pretty fast (at least faster than having to compare the entire tree).
    32 
    44 
    33 from mercurial.demandload import demandload
    45 from mercurial.demandload import demandload
    34 from mercurial.i18n import gettext as _
    46 from mercurial.i18n import gettext as _
    35 from mercurial.node import *
    47 from mercurial.node import *
    36 demandload(globals(), 'mercurial:commands,cmdutil,util os shutil tempfile')
    48 demandload(globals(), 'mercurial:commands,cmdutil,util os shutil tempfile')