summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@qt.io>2019-05-27 16:25:43 +0200
committerFrederik Gladhorn <frederik.gladhorn@qt.io>2019-05-27 14:45:48 +0000
commitf6f2b04bd1dbeae3bdaaf683357087296ab37393 (patch)
treec7704b3de3df0f1610ba6904bf0acadb2b516752
parent64abf60ae196bd3ad59531f48d2e2c78efa5987c (diff)
Gerrit Bot: Message that moving changes is done using the UI
After the Gerrit upgrade, the bot doesn't work any more (we use NoteDB now) and the functionality is in the regular UI. Change-Id: I005b2501d63d6a99c9f643fd77a6451e5c6cfb06 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
-rwxr-xr-xgit-hooks/gerrit-bot33
1 files changed, 1 insertions, 32 deletions
diff --git a/git-hooks/gerrit-bot b/git-hooks/gerrit-bot
index 4bd24b7..6697d91 100755
--- a/git-hooks/gerrit-bot
+++ b/git-hooks/gerrit-bot
@@ -246,38 +246,7 @@ sub process_commit($$$$$)
sub do_move($$$)
{
- my ($chg, $author, $target) = @_;
- my $branch = $$chg{'branch'};
- if ($target eq $branch) {
- return "The change already targets $branch";
- }
- # FIXME: this doesn't work, as for some reason the event stream does not include the status.
- #my %allowed_status = ('NEW' => 1, 'DEFERRED' => 1, 'DRAFT' => 1, 'ABANDONED' => 1);
- #my $status = $$chg{'status'};
- #return "$status changes cannot be moved" if (!$allowed_status{$status});
- my $project = $$chg{'project'};
- my $id = $$chg{'id'};
- # First, check there's no such review on that branch already
- my $query = "project:$project change:$id branch:$target";
- open(my $qry, "-|", @gerrit, "query", "--format", "JSON", $query) or die "cannot run ssh: ".$!;
- while (<$qry>) {
- my $review = decode_json($_);
- defined($review) or die "cannot decode JSON string '".chomp($_)."'\n";
- if (my $url = $$review{'url'}) {
- return "Cannot move: Conflicting change $url - please ask a Gerrit admin for help.";
- }
- }
- close $qry;
- # Only allow the change owner to execute move
- if ($$author{'username'} ne $$chg{'owner'}{'username'}) {
- return "Only the owner is allowed to move a change";
- }
- my $number = $$chg{'number'};
- open(my $retarget, "gerrit_retarget_changes x $target $number 2>&1 |")
- or die "Cannot run gerrit_retarget_changes: ".$!;
- my @output = <$retarget>;
- return "Moved from $branch" if (close($retarget));
- return ($! ? "Failed to move ($!)\n" : "Move rejected ($?)\n") . join(' ', @output);
+ return "Please use the menu in the top right corner 'Move change' instead of this bot.";
}
sub process_move($$$) {