From 38e77a93ee23056daf0fd0fba1781a2799ecb4a7 Mon Sep 17 00:00:00 2001 From: Philip Cook Date: Tue, 12 Jul 2022 16:19:56 -0400 Subject: [PATCH] BUG: Parse Release numbers > 9 properly (#1391) * ENH: Prevent duplicate tags causing any changes in version info --- Utilities/tagRelease.pl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Utilities/tagRelease.pl b/Utilities/tagRelease.pl index 5aaa1728e..666675168 100755 --- a/Utilities/tagRelease.pl +++ b/Utilities/tagRelease.pl @@ -24,7 +24,7 @@ my $tag = $ARGV[0]; -if (!($tag =~ m/^v[0-9]\.[0-9]\.[0-9]/) ) { +if (!($tag =~ m/^v[0-9]+\.[0-9]+\.[0-9]+/) ) { print "Tags for release should be in the format vX.Y.Z where X,Y,Z are integers\n"; exit(1); } @@ -53,12 +53,24 @@ exit(1); } +# Also don't allow a duplicate tag. git will stop this later, but less messy to check here +my @allTags = `git tag`; + +chomp(@allTags); + +foreach my $repoTag (@allTags) { + if ($repoTag == ${tag}) { + print "The tag $tag already exists. Exiting \n"; + exit(1); + } +} + # Check tag matches Version.cmake open(my $inFH, "<", "Version.cmake"); my $versionDotCmake = do { local $/; <$inFH> }; close($inFH); -my ($tagVersionMajor,$tagVersionMinor,$tagVersionPatch) = ($tag =~ m/^v([0-9])\.([0-9])\.([0-9])/); +my ($tagVersionMajor,$tagVersionMinor,$tagVersionPatch) = ($tag =~ m/^v([0-9]+)\.([0-9]+)\.([0-9]+)/); $versionDotCmake =~ s/set\(\$\{PROJECT_NAME\}_VERSION_MAJOR "[0-9]+"\)/set\(\$\{PROJECT_NAME\}_VERSION_MAJOR "${tagVersionMajor}"\)/ or die("Cannot find version information in Version.cmake");