aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xadmin/check_dup_commits60
1 files changed, 60 insertions, 0 deletions
diff --git a/admin/check_dup_commits b/admin/check_dup_commits
new file mode 100755
index 0000000..e2aa083
--- /dev/null
+++ b/admin/check_dup_commits
@@ -0,0 +1,60 @@
+#!/usr/bin/perl -w
+
+$dir = $ENV{SBO_GITROOT} || die "SBO_GITROOT not set\n";
+chdir $dir || die "can't cd to $dir: $!\n";
+
+$ret = 0;
+
+open my $pipe, "-|", "git log --pretty=format:%H:%s master.." or die "$!\n";
+while(<$pipe>) {
+ chomp;
+ my ($hash, $build, undef) = split /:/;
+ $build =~ s/:.*$//;
+ $build =~ s,.*/,,;
+ $hash = substr($hash, 0, 9);
+ $lhashes{$hash}++;
+ $builds{$build}++;
+}
+close $pipe;
+
+for(sort keys %builds) {
+ my $count = $builds{$_};
+ $count < 2 && next;
+ print "$_: has $count local commits\n";
+ $ret++;
+}
+
+print " Fix these, rebase, and do a git push -f\n\n" if $ret;
+
+open $pipe, "-|", "elinks -dump-width 500 -dump -no-numbering -no-references https://slackbuilds.org/ready/";
+while(<$pipe>) {
+ last if /SlackBuild\s+Category/;
+}
+
+while(<$pipe>) {
+ chomp;
+ last if /^$/;
+ my ($build, undef, $hash, undef) = split /\s+/;
+ next if $lhashes{$hash};
+ $rbuilds{$build}++;
+}
+close $pipe;
+
+for(sort keys %builds) {
+ my $count = $rbuilds{$_};
+ if($count) {
+ print "$_: has $builds{$_} local and $count remote commits\n";
+ $ret++;
+ }
+}
+print " Remove local commits, rebase, and do a git push -f\n\n" if $ret;
+
+for(sort keys %rbuilds) {
+ my $count = $rbuilds{$_};
+ $count < 2 && next;
+ print "$_: has $count remote commits\n";
+}
+
+print " Let Willy know he should fix these.\n" if $ret;
+
+exit $ret ? 1 : 0;