[ACCEPTED]-Mercurial: diffs in a particular changeset?-mercurial

Accepted answer
Score: 76

Revision 2580 isn't necessasrily the parent 6 revision of 2581. It's easy to check if 5 it is, of course, but easier yet is to just 4 do:

hg log -p -r 2581

That compares 2581 to its (first) parent 3 revision no matter what it is, and most 2 clearly encompasses the answer to the question 1 "what the hell did 2581 do?"

Score: 6

Try hg diff -r 2580 -r 2581.

0

Score: 5
hg diff -r 2580 -r 2581

This is a wrong example. The revision 2580 6 can be in another branch and you get diff 5 between two branches.

Use

hg log -p -r 2581

or hg diff -c 2581

The difference 4 between them in the first lines. Hg log 3 also show information about changeset (parent, author, date, ...)

I 2 prefer second variant hg diff -c ... because it can store 1 to patch files.

hg diff -c 2581 > revision_2581.patch

Score: 1

Another solution is to use revset notation 7 which IMO is a better solution as you can 6 use it in more places consistently (ie you 5 don't need to know about diff -c and log -p ).

hg diff -r 'last(ancestors(2581),2)'

Yes that 4 is rather verbose compared to -c (for diff) and 3 -p (for log).

However mercurial allows you 2 to create revset aliases

In your .hgrc:

[revsetalias]

next(s) = descendants(s, 1)
prev(s) = last(ancestors(s),2)

Now you 1 can do

hg diff -r 'prev(2581)'
hg log -r 'prev(2581)'

More Related questions