about summary refs log tree commit homepage
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rwxr-xr-xscript/public-inbox-mda14
1 files changed, 12 insertions, 2 deletions
diff --git a/script/public-inbox-mda b/script/public-inbox-mda
index f1eaf629..766d58a6 100755
--- a/script/public-inbox-mda
+++ b/script/public-inbox-mda
@@ -78,8 +78,18 @@ if (ref($ret) && $ret->isa('Email::MIME')) { # filter altered message
 } # else { accept
 
 PublicInbox::MDA->set_list_headers($mime, $dst);
-my $git = PublicInbox::Git->new($main_repo);
-my $im = PublicInbox::Import->new($git, $dst->{name}, $recipient);
+my $v = $dst->{version} || 1;
+my $im;
+if ($v == 2) {
+        require PublicInbox::V2Writable;
+        $im = PublicInbox::V2Writable->new($dst);
+        $im->{parallel} = 0; # pointless to be parallel for a single message
+} elsif ($v == 1) {
+        my $git = $dst->git;
+        $im = PublicInbox::Import->new($git, $dst->{name}, $recipient, $dst);
+} else {
+        die "Unsupported inbox version: $v\n";
+}
 if (defined $im->add($mime)) {
         $emm = $emm->abort;
 } else {