Differences between revisions 1 and 5 (spanning 4 versions)
Revision 1 as of 2008-03-23 15:53:56
Size: 1094
Editor: abuehl
Comment: moved from TipsAndTricks/Intermediate
Revision 5 as of 2008-11-09 23:19:30
Size: 1229
Editor: BrendanCully
Comment: Mention rdiff extension
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:
a) The clone method a) The [:Clone:clone] method
Line 17: Line 17:
MYTIP=`hg tip --template "rev"` MYTIP=`hg tip --template "{rev}"`
Line 24: Line 24:
b) The bundle method b) The [:Bundle:bundle] method
Line 31: Line 31:
This grabs a bundle of incoming changes then overlays the bundle on your current repo to generate the diff.
If the diff is agreeable, you can unbundle the repo to make the changes permanent.
This grabs a bundle of incoming changes then overlays the bundle on your current [:Repository:repository] (see [:LookingIntoBundles]) to generate the diff. If the diff is agreeable, you can unbundle the repo to make the changes permanent.
Line 34: Line 33:
c) Or just use RdiffExtension and run `hg diff http://remoterepo`

Generate a diff between two Repositories

Usually, you can use the -p option to either incoming or outgoing. Example:

cd /path/to/repo1
hg incoming -p /path/to/repo2

Sometimes you may want a single diff. There are a number of ways to do this. We'll describe two:

a) The [:Clone:clone] method

The basic idea is to use a cheap temporary clone to do the work. If the diff is agreeable, you can then pull from your temporary clone.

MYTIP=`hg tip --template "{rev}"`
hg clone -U . tmp # make a temporary clone with no working directory
hg -R tmp pull http://remoterepo # pull the remote changes into the temporary repo
hg -R tmp diff -r $MYTIP -r tip #
rm -rf tmp

b) The [:Bundle:bundle] method

MYTIP=`hg tip --template "{rev}"`
hg in -q --bundle tmp.hg http://remoterepo && hg -R tmp.hg diff -r $MYTIP -r tip

This grabs a bundle of incoming changes then overlays the bundle on your current [:Repository:repository] (see [:LookingIntoBundles]) to generate the diff. If the diff is agreeable, you can unbundle the repo to make the changes permanent.

c) Or just use RdiffExtension and run hg diff http://remoterepo


CategoryTipsAndTricks

GenerateDiffBetweenRepositories (last edited 2012-11-06 22:44:30 by abuehl)