2 # Copyright (C) 2016-2020 all contributors <meta@public-inbox.org>
3 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
6 use Getopt::Long qw/:config gnu_getopt no_ignore_case auto_abbrev/;
7 use PublicInbox::InboxWritable;
8 my $usage = "usage: $0 NAME EMAIL DIR <MBOX\n";
11 my $variant = 'mboxrd';
13 'n|dry-run' => \$dry_run,
14 'V|version=i' => \$version,
15 'F|format=s' => \$variant,
17 GetOptions(%opts) or die $usage;
18 if ($variant ne 'mboxrd' && $variant ne 'mboxo') {
19 die "Unsupported mbox variant: $variant\n";
21 my $name = shift or die $usage; # git
22 my $email = shift or die $usage; # git@vger.kernel.org
23 my $inboxdir = shift or die $usage; # /path/to/v2/repo
25 inboxdir => $inboxdir,
28 address => [ $email ],
29 filter => 'PublicInbox::Filter::Vger',
31 $ibx = PublicInbox::Inbox->new($ibx);
34 require PublicInbox::V2Writable;
35 PublicInbox::V2Writable->new($ibx, 1)->init_inbox(0);
37 system(qw(git init --bare -q), $inboxdir) == 0 or die;
40 $ibx = PublicInbox::InboxWritable->new($ibx);
42 $ibx->import_mbox(\*STDIN, $variant);