本文介绍了Mercurial-同时比较多个变更集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要进行差异化,我们使用:

To diff we use:

  • hg diff -c <xyz>:显示给定变更集的差异
  • hg diff -r <xyz>:显示自给定变更集以来的所有差异
  • hg diff -c <xyz>: Show diffs for a given changeset
  • hg diff -r <xyz>: Show all diffs since a given changeset

但是,假设您有变更集4-5-6-7-8,其中变更集4、6、8与系统的特定区域相关,并且在一个差异中,您仅想查看这三个变更集所做的更改,您将如何执行此操作?如果在变更集4和8中修改了文件A,则差异将显示变更集3和8之间的差异.

But let's say you have changesets 4-5-6-7-8 where changesets 4, 6, 8 were related to a particular area of the system and in one diff you wanted to see the changes made from JUST these three changesets, how would you do this? If file A was modified in changeset 4 and 8, the diff would show the difference between changeset 3 and 8.

推荐答案

如果变更集4,5,6,7,8在历史上是线性的,即使使用,您只需使用-r即可完成.但是,如果5和7中的更改确实来自系统的不同部分,则可以通过添加-X-I获得所需的输出.像这样:

If changesets 4,5,6,7,8 are linear in history I don't think that even with revsets you can do that using just -r. However, if the changes in 5 and 7 really are from a different part of the system you can likely get the output you want by adding a -X or a -I. Something like this:

hg diff -r 3::8 -X part/you/do/not/want/**

hg diff -r 3::8 -I part/you/do/want/**

或者,如果您在历史上尽可能早地对变更集进行育儿,那么您会更精确一些:

If, alternately, you're a little more exact about parenting a changeset as early as possible in history you'd have a topology like this:

[3]---[4]---[6]---[8]---[9]
  \                     /
   ------[5]---[7]------

然后您将得到想要的东西:

and then you'd get what you want using:

hg diff -r 3::8

(请注意,双冒号告诉范围要遵循拓扑,而不仅仅是数字范围)

(note the double colon which tells the range to follow topology not just numeric range)

这篇关于Mercurial-同时比较多个变更集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-01 16:49