简体   繁体   English

生成在hg版本之间更改的文件的列表

[英]Generating a list of which files changed between hg versions

I want to generate a list of which files changed between two revisions in a given directory in Mercurial. 我想生成一个列表,列出Mercurial中给定目录中两个修订版之间的文件。

In particular, I am not interested in what changed, but which files changed in that directory. 特别是,我没兴趣了什么变化, 但文件在该目录中改变。

Eg, supposing that between then and otherthen , only 2 files changed: 例如,假设之间thenotherthen ,只有2个文件改变:

>hg hypothetical-command -r then:otherthen
foo.baz
bar.baz
>

What's the hypothetical command? 什么是假设命令? I've tried diff and log, but I can't see how to convince them to do it: either I get the patch(diff), or I get the whole repo(log). 我已经尝试了差异和日志,但我看不出如何说服他们这样做:要么我得到补丁(差异),要么得到整个回购(日志)。

hg status --rev x:y

where x and y are desired revision numbers (or tag or branch names). 其中xy是所需的修订号(或标签或分支名称)。

If you are using the terminal in windows add hg status --rev x:y > your-file.txt to save the list to a file. 如果您在Windows中使用终端,请添加hg status --rev x:y > your-file.txt将列表保存到文件中。

status is what you need. 状态就是你所需要的。

But, depending what you mean by "between two revisions", you might also consider using the " x::y " (DAG - Directed Acyclic Graph) range. 但是,根据“两个版本之间”的含义,您可能还会考虑使用“ x :: y ”(DAG - 定向非循环图)范围。

Given parallel changesets, 给定并行变更集,

1--2---4 \\---3

hg status --rev 1:4 would return (1,2,3,4), ie anything between and including the endpoints, according to the local, numerical rev . hg status --rev 1:4将返回(1,2,3,4),即根据本地数值转速在端点之间和包括端点之间的任何内容。 This might (and most probably will) return different results in other - though related - repositories! 这可能(并且很可能会)在其他 - 尽管是相关的 - 存储库中返回不同的结果!

hg status --rev 1::4 would return (1,2,4), ie the endpoints, and all changesets which are descendants of '1' AND ancestors of '4'. hg status --rev 1::4将返回(1,2,4),即端点,哪些是“1” 的后代和“4” 的祖先所有的变更。

The latter case, x::y, is usually more useful in real-world applications. 后一种情况x :: y通常在实际应用中更有用。 This is what you get via TortoiseHg\\Visual Diff. 这是你通过TortoiseHg \\ Visual Diff得到的。


>hg help revsets: > hg help revsets:

"x::y" A DAG range, meaning all changesets that are descendants of x and ancestors of y, including x and y themselves. “x :: y”DAG范围,表示作为x的后代和y的祖先的所有变更集,包括x和y本身。 If the first endpoint is left out, this is equivalent to "ancestors(y)", if the second is left out it is equivalent to "descendants(x)". 如果省略第一个端点,这相当于“祖先(y)”,如果省略第二个端点则相当于“后代(x)”。

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

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