}
}
+# takes the output of V2Writable::purge and V2Writable::replace
+# $rewrites = [ array commits keyed by epoch ]
+sub show_rewrites ($$$) {
+ my ($fh, $ibx, $rewrites) = @_;
+ print $fh "$ibx->{mainrepo}:";
+ if (scalar @$rewrites) {
+ my $epoch = -1;
+ my @out = map {;
+ ++$epoch;
+ "$epoch.git: ".(defined($_) ? $_ : '(unchanged)')
+ } @$rewrites;
+ print $fh join("\n\t", '', @out), "\n";
+ } else {
+ print $fh " NONE\n";
+ }
+}
+
1;
next unless $opt->{verbose};
# should we consider this machine-parseable?
- print "$ibx->{mainrepo}:\n\tNONE\n";
+ PublicInbox::AdminEdit::show_rewrites(\*STDOUT, $ibx, []);
next;
}
}
next unless $opt->{verbose};
# should we consider this machine-parseable?
- print "$ibx->{mainrepo}:";
- if (scalar @$commits) {
- print join("\n\t", '', @$commits), "\n";
- } else {
- print "\tNONE\n";
- }
+ PublicInbox::AdminEdit::show_rewrites(\*STDOUT, $ibx, $commits);
}
}
$v2w->done;
if ($opt->{verbose}) { # should we consider this machine-parseable?
- print "$ibx->{mainrepo}:";
- if (scalar @$commits) {
- print join("\n\t", '', @$commits), "\n";
- } else {
- print " NONE\n";
- }
+ PublicInbox::AdminEdit::show_rewrites(\*STDOUT, $ibx, $commits);
}
$n_purged += scalar @$commits;
}
# a successful case:
ok(IPC::Run::run([$purge, $mainrepo], \$raw, \$out, \$err), 'match OK');
-like($out, qr/^\t[a-f0-9]{40,}/m, 'removed commit noted');
+like($out, qr/\b[a-f0-9]{40,}/m, 'removed commit noted');
# add (old) vger filter to config file
print $cfg_fh <<EOF or die "print $!";
ok(chdir('/'), "chdir / OK for --all test");
ok(IPC::Run::run([$purge, '--all'], \$pre_scrub, \$out, \$err),
'scrub purge OK');
-like($out, qr/^\t[a-f0-9]{40,}/m, 'removed commit noted');
+like($out, qr/\b[a-f0-9]{40,}/m, 'removed commit noted');
# diag "out: $out"; diag "err: $err";
$out = $err = '';