python-scripts/22_git_tag.py

15 lines
401 B
Python
Raw Normal View History

2015-01-03 23:13:57 +01:00
import subprocess
import sys
if len(sys.argv) == 3:
tag = sys.argv[1]
commit = sys.argv[2]
command = 'git tag -a {0} {1} -m "{2}"'.format(tag, commit, tag)
output = subprocess.check_output(command, shell=True).decode('utf-8')
subprocess.call(command, shell=True)
subprocess.call('git push --tags', shell=True)
else:
print('usage: tag.py TAG_NAME COMMIT')
2015-01-03 23:13:57 +01:00
sys.exit(1)