summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@gmx.de>2022-02-17 16:48:34 +0100
committerOswald Buddenhagen <oswald.buddenhagen@gmx.de>2022-03-01 11:30:30 +0000
commitbd91da8bd10cdaade641ccd73fbe88c0e7f48d3a (patch)
tree1df8a5b1cbbf0212df18376d9a23172940082d6a
parente527e1011fbf121225ee7bd1107c239998147e34 (diff)
downloadqtrepotools-bd91da8bd10cdaade641ccd73fbe88c0e7f48d3a.tar.gz
gpush: fix adding reviewers to unmodified changes
... with newer gerrit versions. using 'gerrit review' they way we did puts gerrit into a weird state where the named account does not show up in the reviewer/cc list, cannot be added at all any more, and attempts to remove it (via REST) result in an internal server error. so instead use 'gerrit set-reviewers', which works fine, and is actually what early versions of commit 2ceb3a6a did. however, it has the limitation that CCs cannot be added. interestingly enough, using 'set-reviewers' with patchset sha1s triggers the same bug as 'review' did, so use change keys instead (note that this workaround is not applicable to 'review', as that inherently requires sha1s). Change-Id: Ie039f5a04d3a934d4bf6973a008011cb54305ccc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
-rwxr-xr-xbin/git-gpush22
1 files changed, 10 insertions, 12 deletions
diff --git a/bin/git-gpush b/bin/git-gpush
index 667011c..701f536 100755
--- a/bin/git-gpush
+++ b/bin/git-gpush
@@ -1723,7 +1723,7 @@ sub add_if_unmodified($$)
my $freshness = $$change{freshness};
if (($freshness eq UNMODIFIED) || ($freshness eq OUTDATED)) {
- push @$list, $$change{final}{id};
+ push @$list, $$change{gerrit};
}
}
@@ -1849,19 +1849,17 @@ sub update_unpushed($)
$printed = 1;
my ($rvrs, $ccs) = ($$group{add_rvrs} // [], $$group{add_ccs} // []);
- my @rlist;
- foreach my $rvr (@$rvrs) {
- push @rlist, { "reviewer" => $rvr, "state" => "REVIEWER" };
+ if (@$rvrs) {
+ run_process(FWD_OUTPUT | DRY_RUN,
+ 'ssh', @gerrit_ssh, 'gerrit', 'set-reviewers',
+ (map { ('-a', $_) } @$rvrs), '--', (map { $$_{key} } @$invite_list));
}
- foreach my $cc (@$ccs) {
- push @rlist, { "reviewer" => $cc, "state" => "CC" };
+ if (@$ccs) {
+ state $printed_cc;
+ print "Warning: Cannot invite CCs to unmodified commits.\n"
+ if (!$printed_cc);
+ $printed_cc = 1;
}
- my $json = { "reviewers" => \@rlist };
- my $pipe = open_process(USE_STDIN | FWD_OUTPUT | DRY_RUN,
- 'ssh', @gerrit_ssh, 'gerrit', 'review', '--json',
- @$invite_list);
- write_process($pipe, encode_json($json)."\n");
- close_process($pipe);
}
my $topic_list = $$group{topic_list};