Add option --fullyear

This commit is contained in:
Peter J. Holzer 2024-02-01 15:13:50 +01:00
parent c92864febe
commit 5f082698ab
1 changed files with 9 additions and 1 deletions

10
tagger
View File

@ -1,9 +1,14 @@
#!/usr/bin/python3
import argparse
import datetime
import re
import subprocess
ap = argparse.ArgumentParser()
ap.add_argument("--fullyear", action="store_true")
args = ap.parse_args()
subprocess.run(["git", "pull"])
result = subprocess.run(["git", "log", "--pretty=format:%H %D", "--date-order"], stdout=subprocess.PIPE, universal_newlines=True)
found_tags = set()
@ -20,7 +25,10 @@ for ln in result.stdout.split("\n"):
print(need_tag, found_tags)
if need_tag:
today = datetime.date.today()
tag = today.strftime("r%y.%m.%d")
if args.fullyear:
tag = today.strftime("r%Y.%m.%d")
else:
tag = today.strftime("r%y.%m.%d")
if tag in found_tags:
inc = 1
while f"{tag}.{inc}" in found_tags: