简体   繁体   English

汞:如何获取两个不同文件的差异?

[英]Hg: how to get diff of two different files?

I'm sorry if it's odd question. 抱歉,这很奇怪。 I have a mercurial repository. 我有一个商业资料库。 Is it possible to get a diff of two different files from some revision by hg ? 是否可以通过hg从某个修订版本获取两个不同文件的差异? For example, there is a revision 例如,有一个修订

revision xxx
    - file1
    - file2

How I can get a diff of file1 and file2 by standard hg command or any extensions? 如何通过标准hg命令或任何扩展名获取file1file2的差异?

Thank you. 谢谢。

UPD I would like something like this: UPD我想要这样的事情:

hg diff -r xxx file1 file2

Than I will have all changes between two files of same revision. 然后,我将在两个版本相同的文件之间进行所有更改。

Initially I read your question differently, but your comment made clear that you are asking about the differences between two files of the same revision . 最初,我对您的问题的理解有所不同,但是您的评论清楚地表明,您要询问的是同一修订版的两个文件之间的差异。 That's nothing where the VCS has any stakes in. VCS毫无利益可言。

You simply can use (on *nix systems) the diff command: 您只需使用(在* nix系统上)diff命令即可:

diff FILE1 FILE2

If you need the difference of the files at particular revisions, of course you can use mercurial before that in order to get to that: 如果您需要不同版本的文件,当然可以在此之前使用mercurial来达到以下目的:

hg update -rXXX

or even to see the difference of FILE1 at revision XXX compared to FILE2 at revision YYY (but beware, it changes the working dir content; make sure to undo the revert afterwards): 甚至看到版本XXX的FILE1与版本YYY的FILE2的差异(但请注意,它会更改工作目录的内容;请确保随后撤消还原):

hg revert -rXXX FILE1
hg revert -rYYY FILE2
diff FILE1 FILE2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM