如何为名称遵循某种模式的标签创建 revset 别名?
How do I make a revset alias for tags whose names follow a pattern?
在我的存储库中,我有 version-1.2.3
形式的标签。我想创建一个像这样调用的 revset 别名 new()
:
hg log -r 'new(1.2.3, 1.2.4)'
...并扩展为:
hg log -r '::version-1.2.4 - ::version-1.2.3' # What's new in 1.2.4?
当我尝试这样做时:
[revsetalias]
new(, ) = ::version- - ::version-
...Mercurial 将其解释为从修订 version
中减去修订 </code>(例如 <code>1.2.3
),这不是我的本意。
我也尝试过,使用 ##
连接运算符:
new(, ) = ::"version-" ## - ::"version-" ##
但是 hg log -r 'new(1.2.3, 1.2.4)'
给我这个错误:
hg: parse error at 13: syntax error
我也尝试使用 ancestors()
代替 ::
语法,但仍然出现语法错误。这可能吗?
旁注:::
将更具可读性,并为您提供 DAG 的相同部分仅 only()
提供正确的结果 在所有情况下 ,根据 @lc2817 答案中的讨论,DAG 可能会失败)
我几乎成功地得到了答案,但在最后一步遇到了一些麻烦(并且不知道如何调试):在 [revsetalias]
中聚合所有内容
前言
因为参数是标签和 tag() 谓词允许在参数中使用正则表达式 - 我将使用它们
Revset tag("re:version\-")
显示所有标签,以 "version-"
开头
将硬编码数字作为字符串的 Revset 显示单个变更集
hg log -r "tag('re:version\-1.7$')
changeset: 2912:454a12f024f3
(后面的$是必须的,否则都是1.7*标签)
我在 revsetalias 中的最佳尝试是 tag('re:version\-$1$')
- 没有错误也没有输出:我无法完全扩展命令以查看所有处理和替换并使用参数化 revsetalias 检测我的错误
HTH
我测试了以下有效的方法:
new(, ) = (::"version-" ## ) - (::"version-" ## )
供参考 ::
不会给你同样的东西,它意味着 </code> 和 <code>
之间的修订
我更喜欢的等效 revset 是:
new(, ) = only("version-" ## , "version-" ## )
根据文档,它完全等同于您想要的:
"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>).
在我的存储库中,我有 version-1.2.3
形式的标签。我想创建一个像这样调用的 revset 别名 new()
:
hg log -r 'new(1.2.3, 1.2.4)'
...并扩展为:
hg log -r '::version-1.2.4 - ::version-1.2.3' # What's new in 1.2.4?
当我尝试这样做时:
[revsetalias]
new(, ) = ::version- - ::version-
...Mercurial 将其解释为从修订 version
中减去修订 </code>(例如 <code>1.2.3
),这不是我的本意。
我也尝试过,使用 ##
连接运算符:
new(, ) = ::"version-" ## - ::"version-" ##
但是 hg log -r 'new(1.2.3, 1.2.4)'
给我这个错误:
hg: parse error at 13: syntax error
我也尝试使用 ancestors()
代替 ::
语法,但仍然出现语法错误。这可能吗?
旁注:仅 ::
将更具可读性,并为您提供 DAG 的相同部分only()
提供正确的结果 在所有情况下 ,根据 @lc2817 答案中的讨论,DAG 可能会失败)
我几乎成功地得到了答案,但在最后一步遇到了一些麻烦(并且不知道如何调试):在 [revsetalias]
中聚合所有内容前言
因为参数是标签和 tag() 谓词允许在参数中使用正则表达式 - 我将使用它们
Revset tag("re:version\-")
显示所有标签,以 "version-"
将硬编码数字作为字符串的 Revset 显示单个变更集
hg log -r "tag('re:version\-1.7$')
changeset: 2912:454a12f024f3
(后面的$是必须的,否则都是1.7*标签)
我在 revsetalias 中的最佳尝试是 tag('re:version\-$1$')
- 没有错误也没有输出:我无法完全扩展命令以查看所有处理和替换并使用参数化 revsetalias 检测我的错误
HTH
我测试了以下有效的方法:
new(, ) = (::"version-" ## ) - (::"version-" ## )
供参考 ::
不会给你同样的东西,它意味着 </code> 和 <code>
之间的修订
我更喜欢的等效 revset 是:
new(, ) = only("version-" ## , "version-" ## )
根据文档,它完全等同于您想要的:
"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>).