# we'll allow "--only $LOCATION --local"
my $sto = $self->_lei_store(1);
my $lse = $sto->search;
- $sto->write_prepare($self) if $opt->{'import-remote'} //= 1;
+ if (($opt->{'import-remote'} //= 1) |
+ (($opt->{'import-before'} //= \1) ? 1 : 0)) {
+ $sto->write_prepare($self);
+ }
if ($opt->{'local'} //= scalar(@only) ? 0 : 1) {
$lxs->prepare_external($lse);
}
$lxs->prepare_external($_) for @loc;
}
} else {
+ my (@ilocals, @iremotes);
for my $loc (@{$opt->{include} // []}) {
my @loc = $self->get_externals($loc) or return;
$lxs->prepare_external($_) for @loc;
+ @ilocals = @{$lxs->{locals} // []};
+ @iremotes = @{$lxs->{remotes} // []};
}
# --external is enabled by default, but allow --no-external
if ($opt->{external} //= 1) {
my $ne = $self->externals_each(\&prep_ext, $lxs, \%x);
$opt->{remote} //= !($lxs->locals - $opt->{'local'});
if ($opt->{'local'}) {
- delete($lxs->{remotes}) if !$opt->{remote};
+ $lxs->{remotes} = \@iremotes if !$opt->{remote};
} else {
- delete($lxs->{locals});
+ $lxs->{locals} = \@ilocals;
}
}
}