summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@gmx.de>2023-04-16 21:24:32 +0200
committerOswald Buddenhagen <oswald.buddenhagen@gmx.de>2024-01-09 16:37:27 +0000
commit380b5f03fedb41c80c29af0d225dbd4873818568 (patch)
tree144fb01b94642f935e865fa16a6223fc191cbd5b /bin
parent0291926ca1bd9d0b73ce3f2d6bb89e61a83a9ac2 (diff)
gpick: remove local base hinting when assembling remote series
the idea was to augment the remote series with a possibly present local base (when series are chained), in case gerrit doesn't save it for us (which currently is always, as the feature isn't even implemented yet). however, this had three problems: - using sha1s is a non-starter for remote series that have been rebased. - due to missing integration with set_base_deduced(), do_adjust_changes() would be unaware of the base. - the remote side may have re-grouped the series, at which point local hinting would make quite a mess. the first two problems would be fixable with a Change-Id based implementation in set_base_deduced(), but the last one is inherent. so just rip it out. we'll introduce topic-based series splitting in a later commit, which avoids anomalies and is actually visible on gerrit. Change-Id: I5d56f0498e190ac51d2000f89b570f55e48c7ef7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/git-gpick42
1 files changed, 21 insertions, 21 deletions
diff --git a/bin/git-gpick b/bin/git-gpick
index 3c59070..2062c86 100755
--- a/bin/git-gpick
+++ b/bin/git-gpick
@@ -1468,7 +1468,7 @@ sub complete_pushed_series($$)
sub advance_remote_series($$@)
{
- my ($commit, $base, $stamp, $bmap, $missing, $fails) = @_;
+ my ($commit, $base, $stamp, $missing, $fails) = @_;
my ($sha1, $changeid) = ($$commit{id}, $$commit{changeid});
my $ginfo = $gerrit_info_by_sha1{$sha1};
@@ -1486,7 +1486,7 @@ sub advance_remote_series($$@)
return undef;
}
my $rev = $$ginfo{revs}[$$ginfo{pick_idx}];
- my $nbase = $$rev{base} // $$bmap{$changeid};
+ my $nbase = $$rev{base};
$$base = $nbase if (defined($nbase));
return $$rev{id};
}
@@ -1496,16 +1496,16 @@ sub advance_remote_series($$@)
# Additionally, determine the remote group id for the series, which is
# needed for deduce_series(); this is the reason why we always traverse down
# to the bottom of the series even if we need only a part of it.
-sub assemble_remote_series($$$$$$$)
+sub assemble_remote_series($$$$$$)
{
- my ($ginfo, $base, $stamp, $bmap, $seen, $missing, $fails) = @_;
+ my ($ginfo, $base, $stamp, $seen, $missing, $fails) = @_;
my $rev = $$ginfo{revs}[$$ginfo{pick_idx}];
my $sha1 = $$rev{id};
my $rbase = $$rev{base} // $base;
my ($series, $anchor) = assemble_series(
$$ginfo{id}, $sha1, $rbase, $seen, \&advance_remote_series,
- $stamp, $bmap, $missing, $fails);
+ $stamp, $missing, $fails);
if (!$$fails) { # Only an optimization.
# The first Change in the series identifies it. If we got
# cut off, get the ID from the already seen parents.
@@ -1535,7 +1535,7 @@ sub complete_remote_series($$)
next;
}
my ($series, $anchor) = assemble_remote_series(
- $ginfo, $$change{base}, $$spec{stamp}, $$spec{bmap}, \%seen, $missing, \$fails);
+ $ginfo, $$change{base}, $$spec{stamp}, \%seen, $missing, \$fails);
attach_series($series, $anchor, \%result) if (!$fails);
}
$$spec{changes} = \%result if (!$fails);
@@ -1554,7 +1554,7 @@ sub resolve_insertion_spec($$)
# First assemble the entire series.
my $fails = 0;
my ($series, undef) = assemble_remote_series(
- $tip, undef, $stamp, {}, undef, $missing, \$fails);
+ $tip, undef, $stamp, undef, $missing, \$fails);
wfail("Range $$spec{orig} is empty.\n") if (!@$series);
return if ($fails);
@@ -1851,21 +1851,21 @@ sub complete_spec_tails($)
{
my ($specs) = @_;
- foreach my $spec (@$specs) {
- next if ($$spec{action} != UPDATE);
+ if (!$ignore_struct && !$force_struct) {
+ foreach my $spec (@$specs) {
+ next if ($$spec{action} != UPDATE);
- my (%bmap, %pmap);
- foreach my $change (@{$$spec{range}}) {
- my $changeid = $$change{id};
- my $base = $$change{base};
- $bmap{$changeid} = $base if (defined($base));
- next if ($ignore_struct || $force_struct);
- my $pushed = $$change{pushed};
- $pmap{$changeid} = $pushed if (defined($pushed));
- }
- $$spec{bmap} = \%bmap;
- next if ($ignore_struct || $force_struct);
- $$spec{pmap} = \%pmap;
+ my (%bmap, %pmap);
+ foreach my $change (@{$$spec{range}}) {
+ my $changeid = $$change{id};
+ my $base = $$change{base};
+ $bmap{$changeid} = $base if (defined($base));
+ my $pushed = $$change{pushed};
+ $pmap{$changeid} = $pushed if (defined($pushed));
+ }
+ $$spec{bmap} = \%bmap;
+ $$spec{pmap} = \%pmap;
+ }
}
# Now that we have the commits for the tips of all remote specifications,