Compare commits

...

3 Commits

Author SHA1 Message Date
Peter J. Holzer a4164eccb6 Set major to year if previous major was bigger 2025-02-03 10:00:32 +01:00
Peter J. Holzer 3548a55cce Detect multiple tags per commit 2024-08-19 23:32:56 +02:00
Peter J. Holzer 55d8b3133f Add option --force 2024-06-19 16:34:03 +02:00
1 changed files with 5 additions and 4 deletions

9
tagger
View File

@ -10,6 +10,7 @@ ap.add_argument("--fullyear", action="store_true")
ap.add_argument("--day-always", action="store_true")
ap.add_argument("--prefix", default="r")
ap.add_argument("--noop", action="store_true")
ap.add_argument("--force", action="store_true")
args = ap.parse_args()
subprocess.run(["git", "pull"])
@ -19,9 +20,7 @@ need_tag = False
max_major = 0
for ln in result.stdout.split("\n"):
m = re.match(r"[0-9a-f]+ .*\btag: ([-a-z0-9._]+)", ln)
if m:
tag = m.group(1)
for tag in re.findall(r"\btag: ([-a-z0-9._]+)", ln):
if tag.startswith(args.prefix):
found_tags.add(tag)
try:
@ -35,7 +34,7 @@ for ln in result.stdout.split("\n"):
need_tag = True
print(need_tag, found_tags)
if need_tag:
if need_tag or args.force:
today = datetime.date.today()
version = []
if args.fullyear:
@ -46,6 +45,8 @@ if need_tag:
if year % m >= max_major:
major = str(year % m)
break
else:
major = str(year)
version.append(major)
version.append(today.strftime("%m"))
if args.day_always: