Page MenuHomePhabricator

gerrit: submitting a topic requires push option (.../master%topic=my-topic), appending to branch (.../master/my-topic) is no longer supported in Gerrit 3.2
Closed, ResolvedPublic

Description

After the Gerrit 3.2 upgrade, setting a topic by appending it to the branch name is no longer supported. Trying something like

git push gerrit HEAD:refs/for/master/myawesometopic # Append your topic

now fails and the commit is rejected:

git.exe push --progress "origin" version_doc:refs/for/master/version_doc
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 8 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 581 bytes | 581.00 KiB/s, done.
Total 4 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3)
remote: Processing changes: refs: 1, done
To ssh://gerrit.wikimedia.org:29418/pywikibot/core
! [remote rejected]   version_doc -> refs/for/master/version_doc (branch master/version_doc not found)
error: failed to push some refs to 'ssh://gerrit.wikimedia.org:29418/pywikibot/core'


git did not exit cleanly (exit code 1) (3047 ms @ 29.06.2020 17:40:37)

With Gerri 3.2.2, one has to use the [[https://gerrit.wikimedia.org/r/Documentation/user-upload.html#topic|topic push option]]. This one is available since at least Gerrit 2.6. One can either use branch magic

git push gerrit HEAD:refs/for/master%topic=myawesometopic

or pass them explicitly

git push gerrit HEAD:refs/for/master -o topic=myawesometopic

Further available push options can be found it Gerrit's Documentation.

The Gerrit/Advanced usage page got updated accordingly by @Lucas_Werkmeister_WMDE. Thanks!

Event Timeline

Xqt created this task.Jun 29 2020, 3:47 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 29 2020, 3:47 PM
hashar closed this task as Resolved.EditedJun 29 2020, 4:17 PM
hashar claimed this task.
hashar added a subscriber: hashar.

In short: to delimit the branch and the topic, please use %topic= instead of /.


The relevant doc https://gerrit.wikimedia.org/r/Documentation/user-upload.html#topic which states a topic is created by using either of:

  • git push refs/for/<branch>%topic=myawesometopic
  • git push refs/for/<branch> -o topic=myawesometopic

The /refs/for/<branch>/<topic> syntax has been deprecated in Gerrit 2.16 ( 7b89620905450e0fc4c2998760c13a7994b04a29) and emitted a warning:

ReceiveCommits: deprecate legacy topic syntax

This emits a deprecation warning and log statement when the
refs/for/BRANCH/TOPIC syntax is used adding topics to ReceiveCommits.

The only tool known to use this (git-review) has been updated in
https://review.openstack.org/#/c/601251/

The git-review patch has been released in 1.27.0 and indeed:

$ git-review -n -t myawesometopic
Please use the following command to send your commits to review:

	git push origin HEAD:refs/for/master%topic=myawesometopic

Gerrit 3.2.0 removes the feature entirely ( ab50321b610e0ff5aed9af0e4dff2e92371555f6 ). We have jumped from 2.15 to 3.2 and thus moved over their deprecation window.

I updated the “Create a dependency” section of the mw.org page linked in the task description. The “Submitting a change to a branch for review ("backporting")” section also uses the now-removed syntax, but I’m not sure if I should update it, it has signed comments from 2013.

hashar reopened this task as Open.Jun 29 2020, 5:00 PM

Reopening cause surely there must be various stuff we have to fix here and there.

Change 608431 had a related patch set uploaded (by Hashar; owner: Hashar):
[mediawiki/tools/release@master] deploy-promote: fix review push with topic

https://gerrit.wikimedia.org/r/c/mediawiki/tools/release/ /608431

Change 608431 merged by jenkins-bot:
[mediawiki/tools/release@master] deploy-promote: fix review push with topic

https://gerrit.wikimedia.org/r/c/mediawiki/tools/release/ /608431

Change 608873 had a related patch set uploaded (by Hashar; owner: Hashar):
[mediawiki/tools/release@master] deploy-promote: fix review push with topic and label vote

https://gerrit.wikimedia.org/r/c/mediawiki/tools/release/ /608873

Change 608873 merged by jenkins-bot:
[mediawiki/tools/release@master] deploy-promote: fix review push with topic and label vote

https://gerrit.wikimedia.org/r/c/mediawiki/tools/release/ /608873

QChris renamed this task from gerrit: submitting a topic is no longer functional with new gerrit to gerrit: submitting a topic requires push option (.../master%topic=my-topic), appending to branch (.../master/my-topic) is no supported in Gerrit 3.2.Jul 6 2020, 9:29 AM
QChris updated the task description. (Show Details)
QChris renamed this task from gerrit: submitting a topic requires push option (.../master%topic=my-topic), appending to branch (.../master/my-topic) is no supported in Gerrit 3.2 to gerrit: submitting a topic requires push option (.../master%topic=my-topic), appending to branch (.../master/my-topic) is no longer supported in Gerrit 3.2.Jul 7 2020, 6:50 AM
hashar closed this task as Resolved.Jul 7 2020, 8:30 AM

I haven't spotted any other use case beside mediawiki/tools/release deploy-promote script and git-review (see above T256653#6264856 )