问题
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:
- How do I find out which changeset added a tag?
- 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