1963
Comment: Add category extension
|
3541
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
## page was renamed from UsingExtdiff | |
Line 3: | Line 4: |
''Author: Vadim Gelfer'' |
|
Line 11: | Line 14: |
To enable this extension: | To enable this extension (in ~/.hgrc): |
Line 18: | Line 21: |
The {{{extdiff}}} extension also allows to configure new diff commands, so you do not need to type {{{hg extdiff -p kdiff3}}} always. |
Then, the {{{extdiff}}} command should be available: {{{ $ hg extdiff -h hg extdiff [OPT]... [FILE]... use external program to diff repository (or selected files) Show differences between revisions for the specified files, using an external program. The default program used is diff, with default options "-Npru". ... }}} === Use === You can run {{{extdiff}}} with default settings ({{{diff -Npru}}}): {{{ $ hg extdiff making snapshot of 1 files from rev dfe87137ed14 making snapshot of 1 files from working dir diff -Npru crew.dfe87137ed14/mercurial/localrepo.py crew/mercurial/localrepo.py --- crew.dfe87137ed14/mercurial/localrepo.py 2007-01-18 16:04:59.795697215 -0600 +++ crew/mercurial/localrepo.py 2007-01-18 16:04:59.805704181 -0600 @@ -990,10 +990,12 @@ class localrepository(repo.repository): ... }}} Or, use the -p option specify an external diff utility for comparing files: {{{ $ hg extdiff -p kdiff3 }}} Please note that the external diff utility of your choice must be able to compare directories. You may use the {{{-o}}} option to specify options to the external diff utility: {{{ $ hg extdiff -p diff -o -Npruw }}} You may also use {{{--rev/-r}}} and {{{-I/-X}}} options, as well as the list of file or directory names like normal {{{hg diff}}} command. The {{{extdiff}}} extension makes snapshots of only needed files, so running the external diff program will actually be pretty fast (at least faster than having to compare the entire tree). === Create Custom extdiff Commands === The {{{extdiff}}} extension also allows users to configure new diff commands in the hgrc files, so you do not need to type {{{hg extdiff -p kdiff3}}} always. |
Line 47: | Line 99: |
You can use {{{-I/-X}}} options and list of file or directory names like normal {{{hg diff}}} command. The {{{extdiff}}} extension makes snapshots of only needed files, so running the external diff program will actually be pretty fast (at least faster than having to compare the entire tree). |
With the sample configuration above, you may now invoke the new commands: {{{ $ hg vdiff # call kdiff3 $ hg cdiff # call gdiff with -Nprc5 option $ hg meld # call meld }}} |
Extdiff extension
This extension is currently being distributed along with Mercurial.
Author: Vadim Gelfer
Overview
The extdiff Mercurial extension allows you to use external programs to compare revisions, or revision with working dir. The external diff programs are called with a configurable set of options and two non-option arguments: paths to directories containing snapshots of files to compare.
Configuration
To enable this extension (in ~/.hgrc):
[extensions] hgext.extdiff =
Then, the extdiff command should be available:
$ hg extdiff -h hg extdiff [OPT]... [FILE]... use external program to diff repository (or selected files) Show differences between revisions for the specified files, using an external program. The default program used is diff, with default options "-Npru". ...
Use
You can run extdiff with default settings (diff -Npru):
$ hg extdiff making snapshot of 1 files from rev dfe87137ed14 making snapshot of 1 files from working dir diff -Npru crew.dfe87137ed14/mercurial/localrepo.py crew/mercurial/localrepo.py --- crew.dfe87137ed14/mercurial/localrepo.py 2007-01-18 16:04:59.795697215 -0600 +++ crew/mercurial/localrepo.py 2007-01-18 16:04:59.805704181 -0600 @@ -990,10 +990,12 @@ class localrepository(repo.repository): ...
Or, use the -p option specify an external diff utility for comparing files:
$ hg extdiff -p kdiff3
Please note that the external diff utility of your choice must be able to compare directories.
You may use the -o option to specify options to the external diff utility:
$ hg extdiff -p diff -o -Npruw
You may also use --rev/-r and -I/-X options, as well as the list of file or directory names like normal hg diff command. The extdiff extension makes snapshots of only needed files, so running the external diff program will actually be pretty fast (at least faster than having to compare the entire tree).
Create Custom extdiff Commands
The extdiff extension also allows users to configure new diff commands in the hgrc files, so you do not need to type hg extdiff -p kdiff3 always.
[extdiff] # add new command that runs GNU diff(1) in 'context diff' mode cmd.cdiff = gdiff opts.cdiff = -Nprc5 # add new command called vdiff, runs kdiff3 cmd.vdiff = kdiff3 # add new command called meld, runs meld (no need to name twice) cmd.meld = # add new command called vimdiff, runs gvimdiff with DirDiff plugin #(see http://www.vim.org/scripts/script.php?script_id=102) # Non english user, be sure to put "let g:DirDiffDynamicDiffText = 1" in # your .vimrc cmd.vimdiff = gvim opts.vimdiff = -f '+next' '+execute "DirDiff" argv(0) argv(1)'
Each custom diff commands can have two parts: a 'cmd' and an 'opts' part. The cmd.xxx option defines the name of an executable program that will be run, and opts.xxx defines a set of command-line options which will be inserted to the command between the program name and the files/directories to diff (i.e. the cdiff example above).
With the sample configuration above, you may now invoke the new commands:
$ hg vdiff # call kdiff3 $ hg cdiff # call gdiff with -Nprc5 option $ hg meld # call meld