* [PATCH 05/10] v2writable: move {ranges} into $sync state
2019-05-29 8:28 7% [PATCH 00/10] index: support progress output Eric Wong
@ 2019-05-29 8:28 5% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2019-05-29 8:28 UTC (permalink / raw)
To: meta
Yet another temporary variable with no use outside of index_sync.
---
lib/PublicInbox/V2Writable.pm | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index e341d93..eef5576 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -813,14 +813,14 @@ sub last_commits {
# returns a revision range for git-log(1)
sub log_range ($$$$$) {
- my ($self, $git, $ranges, $i, $tip) = @_;
- my $cur = $ranges->[$i] or return $tip; # all of it
+ my ($self, $sync, $git, $i, $tip) = @_;
+ my $cur = $sync->{ranges}->[$i] or return $tip; # all of it
my $range = "$cur..$tip";
if (is_ancestor($git, $cur, $tip)) { # common case
my $n = $git->qx(qw(rev-list --count), $range);
chomp($n);
if ($n == 0) {
- $ranges->[$i] = undef;
+ $sync->{ranges}->[$i] = undef;
return; # nothing to do
}
} else {
@@ -846,7 +846,7 @@ $range
}
sub sync_prepare {
- my ($self, $opts, $epoch_max, $ranges) = @_;
+ my ($self, $sync, $opts, $epoch_max) = @_;
my $pr = $opts->{-progress};
my $regen_max = 0;
my $head = $self->{-inbox}->{ref_head} || 'refs/heads/master';
@@ -866,8 +866,8 @@ sub sync_prepare {
chomp(my $tip = $git->qx(qw(rev-parse -q --verify), $head));
next if $?; # new repo
- my $range = log_range($self, $git, $ranges, $i, $tip) or next;
- $ranges->[$i] = $range;
+ my $range = log_range($self, $sync, $git, $i, $tip) or next;
+ $sync->{ranges}->[$i] = $range;
# can't use 'rev-list --count' if we use --diff-filter
$pr->("$i.git counting changes\n\t$range ... ") if $pr;
@@ -970,8 +970,8 @@ sub index_sync {
D => {}, # "$mid\0$cid" => $oid
reindex => $opts->{reindex},
};
- my $ranges = sync_ranges($self, $sync, $epoch_max);
- $sync->{regen} = sync_prepare($self, $opts, $epoch_max, $ranges);
+ $sync->{ranges} = sync_ranges($self, $sync, $epoch_max);
+ $sync->{regen} = sync_prepare($self, $sync, $opts, $epoch_max);
my @cmd = qw(log --raw -r --pretty=tformat:%H
--no-notes --no-color --no-abbrev --no-renames);
@@ -985,7 +985,7 @@ sub index_sync {
my $git = PublicInbox::Git->new($git_dir);
my $unindex = delete $self->{"unindex-range.$i"};
$self->unindex($opts, $git, $unindex) if $unindex;
- defined(my $range = $ranges->[$i]) or next;
+ defined(my $range = $sync->{ranges}->[$i]) or next;
my $fh = $self->{reindex_pipe} = $git->popen(@cmd, $range);
my $cmt;
while (<$fh>) {
--
EW
^ permalink raw reply related [relevance 5%]
* [PATCH 00/10] index: support progress output
@ 2019-05-29 8:28 7% Eric Wong
2019-05-29 8:28 5% ` [PATCH 05/10] v2writable: move {ranges} into $sync state Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2019-05-29 8:28 UTC (permalink / raw)
To: meta
While progress support was implemented for -xcpdb, there was no
way to enable it for the -index command; and v2 progress was
lacking compared to v1.
This series fills in those functionality gaps and cleans up some
of the v2 indexing code at the same time.
Eric Wong (10):
v2writable: introduce $sync state and put mm_tmp in it
v2writable: sync: move delete markers into $sync state
v2writable: move {reindex} field to $sync state
v2writable: move {regen} into $sync state
v2writable: move {ranges} into $sync state
v2writable: localize unindex-range.$EPOCH to $sync state
v2writable: use prototypes for internal subs
v2writable: move index_sync options to sync state
index: support --verbose option
v2writable: show progress updates for index_sync
lib/PublicInbox/Admin.pm | 18 ++++
lib/PublicInbox/V2Writable.pm | 178 +++++++++++++++++++---------------
lib/PublicInbox/Xapcmd.pm | 14 +--
script/public-inbox-index | 5 +-
4 files changed, 124 insertions(+), 91 deletions(-)
--
EW
^ permalink raw reply [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-05-29 8:28 7% [PATCH 00/10] index: support progress output Eric Wong
2019-05-29 8:28 5% ` [PATCH 05/10] v2writable: move {ranges} into $sync state Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).