简体   繁体   English

hg diff来自某个修订版的两个不同文件

[英]hg diff two different files from a certain revision

I want to see the difference between filea and fileb as of rev1234, because fileb appears to have been a fork-and-change-and-thereafter-run-two-versions-of-one-library, without a super informative commit message. 我想从fileb开始查看fileafileb之间的区别,因为fileb似乎是一个库的分叉和更改,然后运行两个版本,没有超级信息性的提交消息。

I tried hg diff -r 1234 filea fileb , but that just shows me two diffs: 我尝试了hg diff -r 1234 filea fileb ,但hg diff -r 1234 filea fileb显示了两个差异:

  1. that between filea as of rev1234 and its current version, and 从rev1234开始的filea和当前版本之间的值,以及
  2. that between fileb as of rev1234 and its current version 这间fileb作为rev1234和当前版本

I want ONE diff, between filea as of rev1234 and fileb as of rev1234. 我想要一个差异,从rev1234开始的filea和从rev1234 fileb的fileb之间。

I understand that both files are present in r1234? 我知道r1234中都存在这两个文件吗?

If r1234 is not your current working dir state, update your working directory to r1234 beforehand: hg update -r1234 Then you do not need any mercurial command but the normal diff command: diff fileA fileB . 如果r1234不是当前的工作目录状态,请事先将工作目录更新为r1234: hg update -r1234然后,您不需要任何Mercurial命令,而需要常规的diff命令: diff fileA fileB When you're done, hg up again to return to normal. 完成后,再次hg up以恢复正常。

It's roundabout, but you can create a directory, export just those two files from that revision, and then compare them: 这是回旋处,但是您可以创建目录,仅从该修订版导出这两个文件,然后进行比较:

mkdir tempdiff
hg archive -r 1234 -I filea -I fileb tempdiff/
diff tempdiff/filea tempdiff/fileb
rm -r tempdiff

A one-command method would be nice, though. 但是,单命令方法会很好。

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

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