How to check if remote repository contains tag?

落爺英雄遲暮 提交于 2019-12-25 09:00:05

问题


How do I check from the command-line whether a local tag mytag exists on a remote repository and is pointing to the same changeset?

I believe that I can solve this problem once I solve the following sub-problems:

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

回答1:


Based on the aforementioned sub-questions, I believe the following will work:

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


来源:https://stackoverflow.com/questions/41156418/how-to-check-if-remote-repository-contains-tag

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