]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei import: fix --mail-sync handling in LeiInput
authorEric Wong <e@80x24.org>
Sat, 1 May 2021 19:29:05 +0000 (19:29 +0000)
committerEric Wong <e@80x24.org>
Sat, 1 May 2021 23:12:40 +0000 (23:12 +0000)
"lei inspect" also shows "mail-sync" as a field name

lib/PublicInbox/LeiInput.pm
lib/PublicInbox/LeiInspect.pm
t/lei-import-imap.t
t/lei-import-maildir.t

index 86f300c3a572438ac01e475ecaca2ad58c419011..9bcc86e1cacf77c1b18f0302fc2b788bbd4123bc 100644 (file)
@@ -204,7 +204,7 @@ sub prepare_http_input ($$$) {
 sub prepare_inputs { # returns undef on error
        my ($self, $lei, $inputs) = @_;
        my $in_fmt = $lei->{opt}->{'in-format'};
-       my $sync = $lei->{opt}->{sync} ? {} : undef; # using LeiMailSync
+       my $sync = $lei->{opt}->{'mail-sync'} ? {} : undef; # using LeiMailSync
        if ($lei->{opt}->{stdin}) {
                @$inputs and return
                        $lei->fail("--stdin and @$inputs do not mix");
@@ -286,11 +286,11 @@ $input is `eml', not --in-format=$in_fmt
        }
        if ($sync && $sync->{no}) {
                return $lei->fail(<<"") if !$sync->{ok};
---sync specified but no inputs support it
+--mail-sync specified but no inputs support it
 
                # non-fatal if some inputs support support sync
-               $lei->err("# --sync will only be used for @{$sync->{ok}}");
-               $lei->err("# --sync is not supported for: @{$sync->{no}}");
+               $lei->err("# --mail-sync will only be used for @{$sync->{ok}}");
+               $lei->err("# --mail-sync is not supported for: @{$sync->{no}}");
        }
        if ($net) {
                $net->{-can_die} = 1;
index 6cfc80839f767bd9d5b7a838189b548cf284865c..714d252608d586742dc607acac7304ba804ed3b3 100644 (file)
@@ -18,7 +18,7 @@ sub inspect_blob ($$) {
                $ent->{'lei/store'} = \@docids if @docids;
                my $lms = $lse->lms;
                if (my $loc = $lms ? $lms->locations_for($oidhex) : undef) {
-                       $ent->{sync} = $loc;
+                       $ent->{'mail-sync'} = $loc;
                }
        }
        $ent;
index 3a1fff4c32162aecacddf427312e5d0baae96f63..fd15ef4f551d11e19b0bdb10d675855b912658ee 100644 (file)
@@ -54,8 +54,8 @@ test_lei({ tmpdir => $tmpdir }, sub {
        lei_ok('inspect', "blob:$out->[5]->{blob}");
        my $x = json_utf8->decode($lei_out);
        is(ref($x->{'lei/store'}), 'ARRAY', 'lei/store in inspect');
-       is(ref($x->{sync}), 'HASH', 'sync in inspect');
-       is(ref($x->{sync}->{$k[0]}), 'ARRAY', 'UID arrays in inspect');
+       is(ref($x->{'mail-sync'}), 'HASH', 'sync in inspect');
+       is(ref($x->{'mail-sync'}->{$k[0]}), 'ARRAY', 'UID arrays in inspect');
 
        my $psgi_attach = 'cfa3622cbeffc9bd6b0fc66c4d60d420ba74f60d';
        lei_ok('blob', $psgi_attach);
index 02fe43e1bc8880a8da232d39ce87c6da922a99d9..b85d30266c3178922f9501e5cd2e0b41821fd9b3 100644 (file)
@@ -37,7 +37,7 @@ test_lei(sub {
        lei_ok('inspect', "blob:$res->[0]->{blob}");
        $inspect = json_utf8->decode($lei_out);
        is(ref(delete $inspect->{"lei/store"}), 'ARRAY', 'lei/store IDs');
-       is_deeply($inspect, { sync => { "maildir:$md" => [ 'x:2,S' ] } },
+       is_deeply($inspect, { 'mail-sync' => { "maildir:$md" => [ 'x:2,S' ] } },
                'maildir sync info as expected');
 
        lei_ok qw(ls-mail-sync);