开发者

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

开发者 https://www.devze.com 2023-01-04 18:18 出处:网络
I want something like this hg vdiff filename.txt -la开发者_运维技巧stRevision -secondLastRevisionI don\'t know what vdiff is, but how about:

I want something like this

hg vdiff filename.txt -la开发者_运维技巧stRevision -secondLastRevision


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.


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.


Use

hg diff -r -3 -r -2 file
0

精彩评论

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