about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/PublicInbox/LEI.pm2
-rw-r--r--lib/PublicInbox/LeiImport.pm7
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 265b7047..beeb8b48 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -240,7 +240,7 @@ our %CMD = ( # sorted in order of importance/use:
          @c_opt ],
 'import' => [ 'LOCATION...|--stdin',
         'one-time import/update from URL or filesystem',
-        qw(stdin| offset=i recursive|r exclude=s include|I=s jobs=s
+        qw(stdin| offset=i recursive|r exclude=s include|I=s jobs=s new-only
         lock=s@ in-format|F=s kw! verbose|v+ incremental! mail-sync!),
         qw(no-torsocks torsocks=s), PublicInbox::LeiQuery::curl_opt(), @c_opt ],
 'forget-mail-sync' => [ 'LOCATION...',
diff --git a/lib/PublicInbox/LeiImport.pm b/lib/PublicInbox/LeiImport.pm
index e3cb69ca..08794f71 100644
--- a/lib/PublicInbox/LeiImport.pm
+++ b/lib/PublicInbox/LeiImport.pm
@@ -78,12 +78,14 @@ sub do_import_index ($$@) {
         $j =~ /\A([0-9]+),[0-9]+\z/ and $j = $1 + 0;
         $j ||= scalar(@{$self->{inputs}}) || 1;
         my $ikw;
-        if (my $net = $lei->{net}) {
+        my $net = $lei->{net};
+        if ($net) {
                 # $j = $net->net_concurrency($j); TODO
                 if ($lei->{opt}->{incremental} // 1) {
                         $net->{incremental} = 1;
                         $net->{-lms_ro} = $sto->search->lms // 0;
                         if ($self->{-import_kw} && $net->{-lms_ro} &&
+                                        !$lei->{opt}->{'new-only'} &&
                                         $net->{imap_order}) {
                                 require PublicInbox::LeiImportKw;
                                 $ikw = PublicInbox::LeiImportKw->new($lei);
@@ -94,6 +96,9 @@ sub do_import_index ($$@) {
                 my $nproc = $self->detect_nproc;
                 $j = $nproc if $j > $nproc;
         }
+        if ($lei->{opt}->{'new-only'} && (!$net || !$net->{imap_order})) {
+                $lei->err('# --new-only is only for IMAP');
+        }
         my $ops = {};
         $lei->{auth}->op_merge($ops, $self) if $lei->{auth};
         $self->{-wq_nr_workers} = $j // 1; # locked