]> Sergey Matveev's repositories - public-inbox.git/blobdiff - script/public-inbox-convert
inbox: add ->version method
[public-inbox.git] / script / public-inbox-convert
index 3182410e0a6f0e5037bc41b3b0a8bd040389f072..56a810eb054ffc1ea41585eab1052dabb0b7bc12 100755 (executable)
@@ -4,11 +4,9 @@
 use strict;
 use warnings;
 use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
-use PublicInbox::MIME;
 use PublicInbox::InboxWritable;
 use PublicInbox::Config;
 use PublicInbox::V2Writable;
-use PublicInbox::Import;
 use PublicInbox::Spawn qw(spawn);
 use Cwd 'abs_path';
 use File::Copy 'cp'; # preserves permissions:
@@ -20,7 +18,6 @@ my %opts = (
        '--index!' => \$index,
 );
 GetOptions(%opts) or die "bad command-line args\n$usage";
-GetOptions(%opts) or die "bad command-line args\n$usage";
 my $old_dir = shift or die $usage;
 my $new_dir = shift or die $usage;
 die "$new_dir exists\n" if -d $new_dir;
@@ -44,7 +41,7 @@ unless ($old) {
        $old = PublicInbox::Inbox->new($old);
 }
 $old = PublicInbox::InboxWritable->new($old);
-if (($old->{version} || 1) >= 2) {
+if ($old->version >= 2) {
        die "Only conversion from v1 inboxes is supported\n";
 }
 my $new = { %$old };