Created
August 5, 2009 03:14
-
-
Save dagolden/162480 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.010; | |
use strict; | |
use warnings; | |
use File::Slurp 'read_file'; | |
my ($commitlist, $taglist) = @ARGV; | |
die "usage: $0 <commit-list> <tag-list>\n" | |
unless -f $commitlist && -f $taglist; | |
my @commits = map { chomp; $_ } read_file($commitlist); | |
my %tags = map { chomp; $_ => 1 } read_file($taglist); | |
COMMIT: | |
for my $c ( @commits ) { | |
for my $t ( reverse sort keys %tags ) { | |
system "git diff --quiet -b $c $t"; | |
if ( $? == 0 ) { | |
system "git co $c"; | |
system "git tag -d $t"; | |
system "git tag $t"; | |
delete $tags{$t}; | |
next COMMIT; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment