如何找出哪个变更集添加了标签? [英] How do I find out which changeset added a tag?

查看:99
本文介绍了如何找出哪个变更集添加了标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我调用hg tag test,则hg id -r test返回该标记所指向的更改集,但该标记实际上是由后续提交添加的.

If I invoke hg tag test then hg id -r test returns the changeset that the tag points to, but the tag was actually added by the subsequent commit.

如何查找实际添加了标签的变更集(而不是标签所指向的变更集)?

How do I look up the changeset that actually added a tag (as opposed to the changeset that the tag points to)?

可以安全地假设它永远是hg id -r <tag>的子代吗?

Is it safe to assume that it will always be the child of hg id -r <tag>?

推荐答案

假定一个带标签的变更集只有一个孩子(添加标签的孩子),则以下命令将获得添加标签的变更集:

Assuming that a tagged changeset only has one child (the one that adds the tag) then the following commands will get the changeset that adds the tag:

// Get the changeset that the tag points to
def referenced = $(hg id -q -r ${tag})

// Get the changeset that added the tag
def addedTag = $(hg log -r children(${referenced}) --template {node})

这篇关于如何找出哪个变更集添加了标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆