is-tagged.py revision 2152111779d69aefaf7cfe474d80356a5d059d54
# -*- coding: utf-8 -*-
"""
Checks if the current revision of the repository is a tagged revision,
but not 'tip'.
usage:
python is-tagged.py [/path/to/repo]
if no path is given, the current working directory will be used.
Exit status:
0 if the current revision is a tagged version OR
if path is not a Mercurial repository OR
if module import should fail for some reason
1 if the current revision has no tag, except 'tip'
"""
import re
import sys
try:
except ImportError:
try:
except ImportError: # something old/new?
RE = r'^Added\s(?:signature|tag)\s(?:[\w\.]+\s)?for\schangeset\s[\da-f]{12,}$'
def main():
else:
path = '.'
try:
return 0
return 0
return 0
# not tagged
return 1
if __name__ == '__main__':