use Fcntl qw(:DEFAULT);
use Cwd qw/abs_path/;
-my $version = undef;
-my $indexlevel = undef;
-my $skip_epoch;
+my ($version, $indexlevel, $skip_epoch, $skip_artnum, $jobs);
my %opts = (
'V|version=i' => \$version,
'L|indexlevel=s' => \$indexlevel,
'S|skip|skip-epoch=i' => \$skip_epoch,
+ 'N|skip-artnum=i' => \$skip_artnum,
+ 'j|jobs=i' => \$jobs,
);
GetOptions(%opts) or usage();
PublicInbox::Admin::indexlevel_ok_or_die($indexlevel) if defined $indexlevel;
if (!defined $version) {
$version = 2;
} elsif ($version != 2) {
- die "$inboxdir is a -V2 repo, -V$version specified\n"
+ die "$inboxdir is a -V2 inbox, -V$version specified\n"
}
} elsif (-d "$inboxdir/objects") {
if (!defined $version) {
$version = 1;
} elsif ($version != 1) {
- die "$inboxdir is a -V1 repo, -V$version specified\n"
+ die "$inboxdir is a -V1 inbox, -V$version specified\n"
}
}
$version = 1 unless defined $version;
if ($version == 1 && defined $skip_epoch) {
- die "--skip-epoch is only supported for -V2 repos\n";
+ die "--skip-epoch is only supported for -V2 inboxes\n";
}
my $ibx = PublicInbox::Inbox->new({
});
my $creat_opt = {};
-PublicInbox::InboxWritable->new($ibx, $creat_opt)->init_inbox(0, $skip_epoch);
+if (defined $jobs) {
+ die "--jobs is only supported for -V2 inboxes\n" if $version == 1;
+ die "--jobs=$jobs must be >= 1\n" if $jobs <= 0;
+ $creat_opt->{nproc} = $jobs;
+}
+
+$ibx = PublicInbox::InboxWritable->new($ibx, $creat_opt);
+$ibx->init_inbox(0, $skip_epoch, $skip_artnum);
# needed for git prior to v2.1.0
umask(0077) if defined $perm;