gpt4 book ai didi

两个标签之间的 Mercurial 日志

转载 作者:行者123 更新时间:2023-12-01 10:45:31 25 4
gpt4 key购买 nike

我想使用 hg log 生成一个简短的变更日志,涵盖最新版本的变更。发行版标有“v”前缀,例如“v0.9.1”或“v1.0”。是否可以使用 revsets 选择以“v”开头的最后两个标签之间的范围,不包括两个标签中较旧的一个?

举个例子,如果我有:

  • 变更集 0
  • 变更集 1
    标签:v0.1
  • 变更集 2
  • 变更集 3
    标签:酒吧
  • 变更集 4
    标签:v0.9
  • 变更集 5
    标签: foo
  • 变更集 6
  • 变更集 7
    标签:v1.0
  • 变更集 8

如果可能,我想选择变更集 5 到 7,甚至不指定 v0.9 和 v1.0,仅使用“v”前缀。

最佳答案

如果您真的想要“两次修订之间发生了什么变化”这个问题的答案,您必须做一些有点冗长的事情:

hg log -r 'ancestors(relB) - ancestors(relA)'

在有分支开发的情况下,这与 relA::relB 不同。

考虑以下历史图表:

$ hg glog
@ changeset: 7:cb998461fc2f
| tag: tip
| user: Danny Sadinoff <danny>
| date: Fri Nov 21 09:28:46 2014 +0000
| summary: Added tag relB for changeset b37a8f32de1d
|
o changeset: 6:b37a8f32de1d
|\ tag: relB
| | parent: 5:187092bb7e9b
| | parent: 3:2d5af4e62ad5
| | user: Danny Sadinoff <danny>
| | date: Fri Nov 21 09:27:47 2014 +0000
| | summary: merged
| |
| o changeset: 5:187092bb7e9b
| | user: Danny Sadinoff <danny>
| | date: Fri Nov 21 09:27:21 2014 +0000
| | summary: more branch work
| |
| o changeset: 4:dbfe8f003e51
| | parent: 1:68f933b431ec
| | user: Danny Sadinoff <danny>
| | date: Fri Nov 21 09:26:51 2014 +0000
| | summary: branched dev
| |
o | changeset: 3:2d5af4e62ad5
| | user: Danny Sadinoff <danny>
| | date: Fri Nov 21 09:26:17 2014 +0000
| | summary: Added tag relA for changeset 0ad160ab1455
| |
o | changeset: 2:0ad160ab1455
|/ tag: relA
| user: Danny Sadinoff <danny>
| date: Fri Nov 21 09:25:13 2014 +0000
| summary: mainline dev
|
o changeset: 1:68f933b431ec
| user: Danny Sadinoff <danny>
| date: Fri Nov 21 09:24:18 2014 +0000
| summary: added a line
|
o changeset: 0:4738f4f68f1e
user: Danny Sadinoff <danny>
date: Fri Nov 21 09:23:54 2014 +0000

观察@Kevin 的结果与 ancestors() 方法之间的区别:

$ hg log -r 'ancestor(relA, relB)::relB - ancestor(relA, relB)'
changeset: 3:2d5af4e62ad5
user: Danny Sadinoff <danny>
date: Fri Nov 21 09:26:17 2014 +0000
summary: Added tag relA for changeset 0ad160ab1455

changeset: 6:b37a8f32de1d
tag: relB
parent: 5:187092bb7e9b
parent: 3:2d5af4e62ad5
user: Danny Sadinoff <danny>
date: Fri Nov 21 09:27:47 2014 +0000
summary: merged

与讲述整个故事的祖先方法相比。

$ hg log -r 'ancestors(relB)  - ancestors(relA)'
changeset: 3:2d5af4e62ad5
user: Danny Sadinoff <danny>
date: Fri Nov 21 09:26:17 2014 +0000
summary: Added tag relA for changeset 0ad160ab1455

changeset: 4:dbfe8f003e51
parent: 1:68f933b431ec
user: Danny Sadinoff <danny>
date: Fri Nov 21 09:26:51 2014 +0000
summary: branched dev

changeset: 5:187092bb7e9b
user: Danny Sadinoff <danny>
date: Fri Nov 21 09:27:21 2014 +0000
summary: more branch work

changeset: 6:b37a8f32de1d
tag: relB
parent: 5:187092bb7e9b
parent: 3:2d5af4e62ad5
user: Danny Sadinoff <danny>
date: Fri Nov 21 09:27:47 2014 +0000
summary: merged

两次修订之间实际的“最常见修订”似乎是:

 ancestor(ancestors(relB)  - ancestors(relA))

所以一个漂亮的变化日志变成了:

$ hg glog -r 'ancestor(ancestors(relB)  - ancestors(relA))::  relB'
o changeset: 6:b37a8f32de1d
|\ tag: relB
| | parent: 5:187092bb7e9b
| | parent: 3:2d5af4e62ad5
| | user: Danny Sadinoff <danny@sadinoff.com>
| | date: Fri Nov 21 09:27:47 2014 +0000
| | summary: merged
| |
| o changeset: 5:187092bb7e9b
| | user: Danny Sadinoff <danny@sadinoff.com>
| | date: Fri Nov 21 09:27:21 2014 +0000
| | summary: more branch work
| |
| o changeset: 4:dbfe8f003e51
| | parent: 1:68f933b431ec
| | user: Danny Sadinoff <danny@sadinoff.com>
| | date: Fri Nov 21 09:26:51 2014 +0000
| | summary: branched dev
| |
o | changeset: 3:2d5af4e62ad5
| | user: Danny Sadinoff <danny@sadinoff.com>
| | date: Fri Nov 21 09:26:17 2014 +0000
| | summary: Added tag relA for changeset 0ad160ab1455
| |
o | changeset: 2:0ad160ab1455
|/ tag: relA
| user: Danny Sadinoff <danny@sadinoff.com>
| date: Fri Nov 21 09:25:13 2014 +0000
| summary: mainline dev
|
o changeset: 1:68f933b431ec
| user: Danny Sadinoff <danny@sadinoff.com>
| date: Fri Nov 21 09:24:18 2014 +0000
| summary: added a line
|

关于两个标签之间的 Mercurial 日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26850850/

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