X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=blobdiff_plain;f=lib%2FPublicInbox%2FLeiMirror.pm;h=d4b146997c368876298d83f03f59e39aefa385a8;hp=0508c9a8c4aad99ca3cf2b8adddd92cb73a1c1cb;hb=556fb7af0e43c1183933d6afe451eb81296b802c;hpb=af4e0589aa6e29baadf9afd382c6da698395ec8e diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index 0508c9a8..d4b14699 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -991,6 +991,34 @@ sub dump_manifest ($$) { utime($mtime, $mtime, "$ft") or die "utime(..., $ft): $!"; } +sub dump_project_list ($$) { + my ($self, $m) = @_; + my $f = $self->{'-project-list'} // return; + my $old = PublicInbox::Git::try_cat($f); + my %new; + + open my $dh, '<', '.' or die "open(.): $!"; + chdir($self->{dst}) or die "chdir($self->{dst}): $!"; + my @local = grep { -e $_ ? ($new{$_} = undef) : 1 } split(/\n/s, $old); + chdir($dh) or die "chdir(restore): $!"; + + $new{substr($_, 1)} = 1 for keys %$m; # drop leading '/' + my @list = sort keys %new; + my @remote = grep { !defined($new{$_}) } @list; + + warn <{src}: +EOM + warn "\t", $_, "\n" for @remote; + warn <splitpath($f); + atomic_write($dn, $bn, join("\n", @list, '')); +} + # FIXME: this gets confused by single inbox instance w/ global manifest.js.gz sub try_manifest { my ($self) = @_; @@ -1104,6 +1132,7 @@ EOM warn(<{opt}->{$k} // next; $v = $default if $v eq ''; $v = "$self->{dst}/$v" if $v !~ m!\A\.{0,2}/!; $self->{"-$k"} = $v; } + local $LIVE = {}; local $TODO = {}; local $FGRP_TODO = {};