]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiRediff.pm
www_stream: sh-friendly .onion URLs wrapping
[public-inbox.git] / lib / PublicInbox / LeiRediff.pm
index d73e3e286f4f0c325d0dcb20c67a8d7f5fd8c38a..0ba5897c7ba8748ec1a1a358fd44516975c265b3 100644 (file)
@@ -70,7 +70,6 @@ EOM
        my $tb = $ta;
        $tb =~ tr!A!B!;
        my $lei = $self->{lei};
-       my $wait = delete($self->{-do_done}) ? $lei->{sto}->ipc_do('done') : 0;
        while (my ($oid_a, $oid_b, $pa, $pb, $ma, $mb) = splice(@$ctxq, 0, 6)) {
                my $xa = $blob->{$oid_a} //= solve_1($self, $oid_a,
                                                        { path_b => $pa });
@@ -109,8 +108,9 @@ EOM
        push @cmd, '--'.($opt->{color} && !$opt->{'no-color'} ? '' : 'no-').
                        'color';
        for my $o (@PublicInbox::LEI::diff_opt) {
-               $o =~ s/\|([a-z0-9])\b//i; # remove single char short option
-               my $c = $1;
+               my $c = '';
+               # remove single char short option
+               $o =~ s/\|([a-z0-9])\b//i and $c = $1;
                if ($o =~ s/=[is]@\z//) {
                        my $v = $opt->{$o} or next;
                        push @cmd, map { $c ? "-$c$_" : "--$o=$_" } @$v;
@@ -193,15 +193,14 @@ sub extract_oids { # Eml each_part callback
 
 sub input_eml_cb { # callback for all emails
        my ($self, $eml) = @_;
-       $self->{lei}->{sto}->ipc_do('add_eml', $eml);
-       $self->{-do_done} = 1;
+       $self->{tmp_sto}->add_eml($eml);
+       $self->{tmp_sto}->done;
        $eml->each_part(\&extract_oids, $self, 1);
 }
 
 sub lei_rediff {
        my ($lei, @inputs) = @_;
        $lei->_lei_store(1)->write_prepare($lei);
-       $lei->{opt}->{stdin} = 1 if !@inputs;
        $lei->{opt}->{'in-format'} //= 'eml';
        # maybe it's a non-email (code) blob from a coderepo
        my $git_dirs = $lei->{opt}->{'git-dir'} //= [];
@@ -216,7 +215,7 @@ sub lei_rediff {
                $lei->{curl} //= which('curl') or return
                        $lei->fail('curl needed for', $lxs->remotes);
        }
-       $lei->ale->refresh_externals($lxs);
+       $lei->ale->refresh_externals($lxs, $lei);
        my $self = bless {
                -force_eml => 1, # for LeiInput->input_fh
                lxs => $lxs,
@@ -228,7 +227,7 @@ sub lei_rediff {
        my ($op_c, $ops) = $lei->workers_start($self, 1);
        $lei->{wq1} = $self;
        net_merge_all_done($self) unless $lei->{auth};
-       $op_c->op_wait_event($ops);
+       $lei->wait_wq_events($op_c, $ops);
 }
 
 sub ipc_atfork_child {
@@ -239,7 +238,11 @@ sub ipc_atfork_child {
        binmode $lei->{1}, ':utf8';
        $self->{blobs} = {}; # oidhex => filename
        $self->{rdtmp} = File::Temp->newdir('lei-rediff-XXXX', TMPDIR => 1);
-       $self->{rmt} = [ map {
+       $self->{tmp_sto} = PublicInbox::LeiStore->new(
+                       "$self->{rdtmp}/tmp.store",
+                       { creat => { nproc => 1 }, indexlevel => 'medium' });
+       $self->{tmp_sto}->{priv_eidx}->{parallel} = 0;
+       $self->{rmt} = [ $self->{tmp_sto}->search, map {
                        PublicInbox::LeiRemote->new($lei, $_)
                } $self->{lxs}->remotes ];
        $self->{gits} = [ map {