Differences between revisions 3 and 4
Revision 3 as of 2009-05-19 19:31:01
Size: 955
Editor: localhost
Comment: converted to 1.6 markup
Revision 4 as of 2009-11-23 13:08:01
Size: 1311
Comment: Mercurial 1.4 has "hg diff --stat"
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

=== Mercurial version 1.4 ===

Mercurial 1.4 includes a "hg diff --stat" option; to get a pull diffstat, add the following lines to your [[.hgrc]]:

{{{
[hooks]
changegroup=hg diff --stat -r $HG_NODE -r tip
}}}

Now you will see a diffstat of the new changes to your [[Repository|repository]] every time you do "hg [[Pull|pull]]".

=== Mercurial versions 1.3.1 and earlier ===
Line 28: Line 41:
See also: [[DiffstatExtension]]

See diffstat of pulled changes

Mercurial version 1.4

Mercurial 1.4 includes a "hg diff --stat" option; to get a pull diffstat, add the following lines to your .hgrc:

[hooks]
changegroup=hg diff --stat -r $HG_NODE -r tip

Now you will see a diffstat of the new changes to your repository every time you do "hg pull".

Mercurial versions 1.3.1 and earlier

Place the following script (named "pull-diffstat" here) somewhere in your $PATH:

test -n "$HG_NODE" || exit 0
TIP=`hg tip --template '{node|short}'`
REV=`hg log -r $HG_NODE --template '{rev}'`
test -n "$REV" -a $REV -ne 0 || exit 0
PREV=`expr $REV - 1`
PARENT=`hg log -r $PREV --template '{node|short}'`
echo "diffstat for $PARENT to $TIP" 1>&2
hg diff -r $PARENT -r tip | diffstat 1>&2

Add a changegroup entry to the [hooks] section of .hgrc:

[hooks]
changegroup = pull-diffstat

Now you will see a diffstat of the new changes to your repository every time you do "hg pull".

Note: When pushing to a repository that has enabled this script, the script will cause a ValueError exception. The push will however continue and there seem to be no negative effects.


CategoryTipsAndTricks

DiffstatOfPulledChanges (last edited 2012-11-11 19:34:46 by abuehl)