Mercurial:如何找到我的分支上次合并到默认值的时间

Mercurial: How to find last time my branch was merged into default

是否有一些 Mercurial 修订集魔法可用于在 default 分支上找到合并特定分支(我们称之为 mybranch)的最后一个变更集?

或者同样很好地找到合并到 default 中的 mybranch 的最后修订版?

此外,列出从 mybranch 移植到 default 的变更集的方法会很好。

hg help revsets作为来源,从最后一题开始

嫁接变更集列表

"destination([set])" 
Changesets that were created by a graft, transplant or rebase operation, with the given
revisions specified as the source.
Omitting the optional set is the same as passing all().

对于“...从 mybranch 移​​植到默认的变更集”revset 将是

destination(branch("mybranch")) & branch("default")

更好:您可以将其存储为 revsetalias(TBT!)

[revsetalias]
grafted(from, to) = destination(branch(from)) & branch(to)

并将其用于任何一对分支(扩展到自定义数量的源将是未来的任务)。

上次合并修订

Step-by-step

  • “...合并特定分支的默认分支上的最后一个变更集”是 a) mergeset b) 最新的如果合并更多一次 c) 其中一个 parents 属于 branch-in-question
  • 你必须测试 revset,如果我混淆了 parents,请在 revset 中交换 p1 和 p2(现在无法调试)
  • Revset 必须为最常见的任务做好准备 "Get the latest mergepoint of branch FROM to branch TO"

merge() & branch("to") - TO

中的所有合并点

p2(merge() & branch("to")) & branch("from") - parent 以上合并仅来自

child(p2(merge() & branch("to")) & branch("from")) & branch("to") - 以上 parent 中的 child 仅在 TO 中(因为它们在其他分支中也可以有 child)

last(child(p2(merge() & branch("to")) & branch("from")) & branch("to")) - 如果合并发生不止一次,则为最新的合并点。

一组 revsetaliases(为了更好的可读性)作为结果

[revsetalias]
ms(to) = merge() & branch(to)

ms2b(to,from) = (child(p2(ms(to))) & branch(from)) & branch(to)

fp_ms(to,from) = p2(ms(to)) & branch(from)

以及您的修订集:

  • 最新合并点last(ms2b("default","mybranch"))
  • 最新国外parentlast(fp_ms("default","mybranch"))

添加和演示

我修复了 ms2b(),如下面 THG 的重新浏览器屏幕截图所示。从稳定合并到默认 "as is"

children(p2(merge() & branch(default)) & branch(stable)) & branch(default)

带有参数和之前准备好的 revsetaliases

ms2b(to,from) = children(p2(ms(to)) & branch(from)) & branch(to)