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");