about summary refs log tree commit homepage
path: root/lib/PublicInbox/V2Writable.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-05-23 09:36:58 +0000
committerEric Wong <e@80x24.org>2019-05-23 17:43:50 +0000
commit3e894f400e588246f529dd4fb1257e19e63a17ed (patch)
tree22c03bcb053394043bc832ce39abfc557ea670c7 /lib/PublicInbox/V2Writable.pm
parent24363017ffeba73f5b02c5e2d1dc465c682c676b (diff)
downloadpublic-inbox-3e894f400e588246f529dd4fb1257e19e63a17ed.tar.gz
Emit information about reindexing git revision ranges when used
with xcpdb.  Additionally, distinguish Xapian copy output from
v2 git epoch counting by increasing directory context info.

For now, v1 batches batches are emitted.  v2 indexing is still
missing progress reporting for batches, as the data structures
for reindexing would benefit from a refactoring, first.

This does not currently affect the use of public-inbox-index,
but may in the future.
Diffstat (limited to 'lib/PublicInbox/V2Writable.pm')
-rw-r--r--lib/PublicInbox/V2Writable.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index 1ee19b21..1170f32c 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -777,6 +777,9 @@ sub reindex_oid {
                 $git->cleanup;
                 $mm_tmp->atfork_prepare;
                 $self->done; # release lock
+
+                # TODO: print progress info, here
+
                 # allow -watch or -mda to write...
                 $self->idx_init; # reacquire lock
                 $mm_tmp->atfork_parent;
@@ -844,6 +847,7 @@ $range
 
 sub index_prepare {
         my ($self, $opts, $epoch_max, $ranges) = @_;
+        my $pr = $opts->{-progress};
         my $regen_max = 0;
         my $head = $self->{-inbox}->{ref_head} || 'refs/heads/master';
         for (my $i = $epoch_max; $i >= 0; $i--) {
@@ -858,10 +862,14 @@ sub index_prepare {
                 $ranges->[$i] = $range;
 
                 # can't use 'rev-list --count' if we use --diff-filter
+                $pr->("$i.git counting changes\n\t$range ... ") if $pr;
+                my $n = 0;
                 my $fh = $git->popen(qw(log --pretty=tformat:%H
                                 --no-notes --no-color --no-renames
                                 --diff-filter=AM), $range, '--', 'm');
-                ++$regen_max while <$fh>;
+                ++$n while <$fh>;
+                $pr->("$n\n") if $pr;
+                $regen_max += $n;
         }
         \$regen_max;
 }