gpt4 book ai didi

mercurial - 是否有与 git log --first-parent 等效的 Mercurial?

转载 作者:行者123 更新时间:2023-12-01 11:45:56 24 4
gpt4 key购买 nike

git log --first-parent 忽略 merge 提交的第一个父级以外的所有内容。

例子:

$ git log --oneline --graph

* 087f5ed Master C
* 36c50a2 Merge branch 'feature'
|\
| * 98c89df Feature B
| * 89b3a7b Feature A
* | 9a95133 Master B
|/
* 766c9b0 Master A

$ git log --oneline --graph --first-parent

* 087f5ed Master C
* 36c50a2 Merge branch 'feature'
* 9a95133 Master B
* 766c9b0 Master A

是否有 Mercurial 等效项?

最佳答案

直接等效:hg log -r '_firstancestors(...)'

有一个直接的等效项:隐藏的 revset _firstancestors 跟随每个 merge 的第一个父级 (p1) 侧。在 Mercurial 中,就像在 Git 中一样,第一个父项是调用 hg merge [second parent] 时 check out 的提交。

hg log -r '_firstancestors(myfeature)'

'hidden' 表示它以下划线开头,在帮助等中没有列出,但如果您知道它存在,仍然可以使用。我不知道为什么它被隐藏了。

例子

此 revset 别名列出了功能分支上的所有提交,同时忽略所有祖先,每当 master merge 到分支中以使其保持最新状态。 (我工作的商店更喜欢 merge 而不是 rebase )。

[revsetalias]
feature($1) = _firstancestors($1) and not _firstancestors(master)

[alias]
f = log -r "feature($(echo $HG_ARGS| sed 's/^f //'))"

示例用法(使用我自己的日志模板):

$ hg f myfeature
o 423 myfeature default/myfeature -- Esteis -- 2016-07-12 -- 123abc
| this
o 422 -- Esteis -- 2016-07-12 -- 123def
|\ merge master into myfeature
o ~ 421 -- Esteis -- 2016-07-12 -- 456abc
| that
o 420 -- Esteis -- 2016-07-12 -- 789def
| and the other

关于mercurial - 是否有与 git log --first-parent 等效的 Mercurial?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15376649/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com