Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to see difference between last two versions of a file using hg commands?

Tags:

mercurial

I want something like this

hg vdiff filename.txt -lastRevision -secondLastRevision

like image 285
Nitesh Avatar asked Jun 27 '10 23:06

Nitesh


3 Answers

I don't know what vdiff is, but how about:

hg diff -r rev1 -r rev2 filename.txt

Edit: to get the last 2 revisions, that would be:

hg diff -r -2 -r -1 filename.txt

Type hg help revisions for information about specifying revisions.

like image 67
JWWalker Avatar answered Nov 23 '22 19:11

JWWalker


As of this writing, the top answers refer to -1, -2 and -3. The negative integers are historical artifacts and should not be used with modern Mercurial workflows.

Typically, the "last version" means "the currently checked out revision". In that case, to see the changes to file in the currently checked out commit, you can use

hg diff --change . filename.txt

If you'd like to see the last time filename.txt was changed, you can use

hg log --follow --patch --limit 1 filename.txt

The --follow argument causes hg log to follow history, so it'll only output the current revision or its ancestors.

like image 37
rain Avatar answered Nov 23 '22 17:11

rain


Use

hg diff -r -3 -r -2 file
like image 41
Loxley Avatar answered Nov 23 '22 17:11

Loxley