你如何找到 mercurial 中两个标签之间的变更集?

How do you find the changesets between two tags in mercurial?

如果我有两个名为 2.0 和 2.1 的标签,我如何找到两者之间的变更集消息?我正在尝试找到一种使用 HG 制作发行说明并列出与提交相关的不同消息的方法。

示例变更集:

changeset: 263:5a4b3c2d1e user: User Name <user.name@gmail.com> date: Tue Nov 27 14:22:54 2018 -0500 summary: Added tag 2.0.1 for changeset 9876fghij

期望的输出:

Added tag 2.1 for changeset 67890pqrst Change Info... Added tag 2.0.1 for changeset 9876fghij Change Info... Added tag 2.0 for changeset klmno12345

您需要使用 revset 来 select 两个标签之间的所有变更集,例如:2.0::2.1 可能会成功。您可以通过 运行: hg log -G -r '2.0::2.1' 验证 selected 变更集。 (有关 revset 的更多信息,请参阅 hg help revset)。

拥有正确的 selected 变更集后,您现在可以应用模板来仅检索所需的信息。例如,如果您只想要变更集描述的第一行,则可以对整个描述执行 hg log -r '2.0::2.1' -T '{desc}\n' 或仅对每个变更集描述的第一行执行 hg log -r '2.0::2.1' -T '{desc|firstline}\n'

如果您想添加更多信息,hg help template 是您的朋友。

前言

"Any challenge has a simple, easy-to-understand wrong decision"。 Boris 的回答是对这条规则最好的说明:“::”topo-range 将产生良好的结果 only 在纯单分支开发的情况下(通常,坏主意 (tm) 无论如何)

好的解决方案必须正确处理复杂的 DAG 并回答问题 "New changesets included in NEW, missing in OLD (regardless of the nature of occurrence)"

对我来说,它是 "only()" 具有两个参数的 revsets 函数

"only(set, [set])"

Changesets that are ancestors of the first set that are not ancestors of any other head in the repo. If a second set is specified, the result is ancestors of the first set that are not ancestors of the second set (i.e. ::set1 - ::set2).

hg log -r "only(2.1,2.0)"

可能是为了更好地展示预定义的样式 "changelog"

hg log -r "only(2.1,2.0)" -s changelog

或自定义样式|模板