[ACCEPTED]-View differences between two changesets on one file-mercurial

Accepted answer
Score: 61

hg diff -r <first_revision_number>:<other_revision_number> filename

that will do it

e.g hg diff -r 0:1 default.aspx

hope it helps


Score: 43

If you know the revision numbers, then what 19 PaulStack said is correct.

If you explicitly want 18 to know the difference between the current 17 tip of the branch, and it's previous, you 16 can use shortcuts. Of course, if the file 15 hasn't changed, the diff won't show anything 14 useful.

hg diff -r -1:. filename

The -1 says previous changeset on this 13 branch. the '.' means the current changeset. You 12 can use -2, -3 etc, but once you hit a merge 11 point, it gets a little more interesting. (reference: http://hgtip.com/tips/beginner/2009-10-05-shortcuts-for-specifying-revisions/)

If 10 what you want is the outstanding changes 9 in your workspace, then it's merely hg diff 8 filename.

A few useful places for HG newbies 7 is http://hgtip.com.

The HG definitive guide at http://hgbook.red-bean.com/.

A stackoverflow 6 like site that's more HG specific is the 5 Kiln support site. http://kiln.stackexchange.com. Kiln is built on top 4 of HG, and uses a modified TortoiseHG client, so 3 most of the questions and answers there 2 are informative. They will also answer questions 1 even if you aren't a user.

Score: 0

there is also de ^ syntax for the parent 5 revision, which in addition to . (the parent 4 of the working directory) make a useful 3 combination:

show the diff between current 2 checked out revision and its parent revision 1 (this works around tip and -1 limitations)

hg diff -r .^:.

More Related questions