DerKuchen
DerKuchen

Reputation: 1880

Mercurial: Creating a diff of two commits

Is there a way to get the changes of two commits with mercurial? The second commit is not directly after the first one, there are some other ones between them.

I tried

hg diff [some params] --change xxxxx --change yyyyy > file.patch

but that only includes the last changeset.

If there is no way to achieve this with hg, is there maybe a tool to combine patches?

Upvotes: 39

Views: 29132

Answers (3)

Chris McCauley
Chris McCauley

Reputation: 26383

An external diff

The extdiff extension will allow you to use your preferred external diff tool. In my case I use meld so day to day I run this type of command

hg meld -r <rev1> -r <rev2>

First enable the extdiff extension in the extensions section (I also have shelve & record enabled)

[extensions]
shelve =
record =
hgext.extdiff =

Then add this section ...

[extdiff]
cmd = meld
cmd.meld = /usr/bin/meld

to your .hgrc file. Obviously replace meld with the command used to launch your preferred tool

Upvotes: 6

Lazy Badger
Lazy Badger

Reputation: 97282

Export? One patch-file per changeset, something like

hg export --output %r.patch --rev A --rev B

Upvotes: 2

the daniel
the daniel

Reputation: 596

I came upon this page while trying to figure this very thing out. I found my solution via hg help diff .

hg diff -r <rev> -r <rev> worked for my needs (diffing between two tags)

Upvotes: 58

Related Questions