开发者

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 ma开发者_StackOverflowybe a tool to combine patches?


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)


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


Export? One patch-file per changeset, something like

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜