如何检查远程存储库是否包含标记?

时间:2016-12-15 04:25:56

标签: command-line mercurial

如何从命令行检查远程存储库中是否存在本地标记mytag并指向相同的变更集?

我相信一旦解决了以下子问题,我就能解决这个问题:

  1. How do I find out which changeset added a tag?
  2. How to find out whether a remote repository contains a changeset?

1 个答案:

答案 0 :(得分:0)

根据上述子问题,我相信以下内容可行:

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

// Check whether the remote repository contains the changeset
def tagFound = $(hg outgoing -r ${addedTag})