]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LEI.pm
www_stream: add trailing slash for help and color links
[public-inbox.git] / lib / PublicInbox / LEI.pm
index 9bf60ad454aef3aa5f2208e16836d6fc1f9a7f28..a0986f386a165de5690ded33bca4c3042df51898 100644 (file)
@@ -113,7 +113,7 @@ our %CMD = ( # sorted in order of importance/use:
        qw(save-as=s output|mfolder|o=s format|f=s dedupe|d=s threads|t+
        sort|s=s reverse|r offset=i remote! local! external! pretty
        include|I=s@ exclude=s@ only=s@ jobs|j=s globoff|g augment|a
-       import-remote! import-before! lock=s@
+       import-remote! import-before! lock=s@ rsyncable
        alert=s@ mua=s no-torsocks torsocks=s verbose|v+ quiet|q C=s@),
        PublicInbox::LeiQuery::curl_opt(), opt_dash('limit|n=i', '[0-9]+') ],
 
@@ -412,9 +412,9 @@ sub check_input_format ($;$) {
                return fail($self, "--$opt_key unset for $err");
        }
        require PublicInbox::MboxLock if $files;
+       require PublicInbox::MboxReader;
        return 1 if $fmt eq 'eml';
        # XXX: should this handle {gz,bz2,xz}? that's currently in LeiToMail
-       require PublicInbox::MboxReader;
        PublicInbox::MboxReader->can($fmt) or
                return fail($self, "--$opt_key=$fmt unrecognized");
        1;
@@ -606,8 +606,10 @@ sub _lei_cfg ($;$) {
        my $f = _config_path($self);
        my @st = stat($f);
        my $cur_st = @st ? pack('dd', $st[10], $st[7]) : ''; # 10:ctime, 7:size
+       my ($sto, $sto_dir);
        if (my $cfg = $PATH2CFG{$f}) { # reuse existing object in common case
                return ($self->{cfg} = $cfg) if $cur_st eq $cfg->{-st};
+               ($sto, $sto_dir) = @$cfg{qw(-lei_store leistore.dir)};
        }
        if (!@st) {
                unless ($creat) {
@@ -625,6 +627,10 @@ sub _lei_cfg ($;$) {
        bless $cfg, 'PublicInbox::Config';
        $cfg->{-st} = $cur_st;
        $cfg->{'-f'} = $f;
+       if ($sto && File::Spec->canonpath($sto_dir) eq
+                       File::Spec->canonpath($cfg->{'leistore.dir'})) {
+               $cfg->{-lei_store} = $sto;
+       }
        $self->{cfg} = $PATH2CFG{$f} = $cfg;
 }