Differences between revisions 1 and 6 (spanning 5 versions)
Revision 1 as of 2008-03-23 16:05:22
Size: 878
Editor: abuehl
Comment: moved from TipsAndTricks/Intermediate
Revision 6 as of 2010-11-18 11:04:59
Size: 1826
Comment:
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]]".

If your having problems with the above (not showing all changes or showing changes from working directory) you could try:

{{{
[hooks]
changegroup=hg log -r $HG_NODE:tip --stat --template '{empty}'
}}}

Another possibility is usage of hook, written in Python - this skips starting another instance of Mercurial is generally faster (though maybe a bit more fiddly to set up). You can find code and example how to set up [[http://mercurial.selenic.com/hg/hg/file/tip/contrib/python-hook-examples.py|here]].

=== Mercurial versions 1.3.1 and earlier ===
Line 17: Line 39:
Add a changegroup entry to the [hooks] section of hgrc: Add a changegroup entry to the [hooks] section of [[.hgrc]]:
Line 24: Line 46:
Now you will see a diffstat of the new changes to your repo every time you do "hg pull". Now you will see a diffstat of the new changes to your [[Repository|repository]] every time you do "hg [[Pull|pull]]".
Line 26: Line 48:
'''Note:''' When pushing to a repo 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. '''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.

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".

If your having problems with the above (not showing all changes or showing changes from working directory) you could try:

[hooks]
changegroup=hg log -r $HG_NODE:tip --stat --template '{empty}'

Another possibility is usage of hook, written in Python - this skips starting another instance of Mercurial is generally faster (though maybe a bit more fiddly to set up). You can find code and example how to set up here.

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)