How do I find out which changeset added a tag?

耗尽温柔 提交于 2019-12-25 17:47:38

问题


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)?

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


回答1:


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})


来源:https://stackoverflow.com/questions/41156538/how-do-i-find-out-which-changeset-added-a-tag

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!