aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-09-16 06:27:59 -0400
committerB. Watson <urchlay@slackware.uk>2026-09-16 06:27:59 -0400
commite56300a9b733c05b6fb9e08dc57fb05cd87e8c19 (patch)
treefb7095cb16b3faedd6f2916511e3407033793880
parent3ca437c696799b097d544c4c5d6888f84caae74c (diff)
downloadsbostuff-e56300a9b733c05b6fb9e08dc57fb05cd87e8c19.tar.gz
check_dup_commits: Added.
-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;