We have a couple of submodules in our project. So let's say one developer implements a new feature that affects several of those submodules and uploades his changes to gerrit patchsets with all the same topic.
So when I want to download his changes I can get the download links from the gerrit webinterface. But I would have to do this for every submodule.
Is there an easy way to automagically fetch the patch sets via the topic name?
Something like git fetch origin refs/changes/*topicname* ?
Or will I have to use gerrit REST API?
I wrote a little script for this - it was easier than I thought.
Here is what to do:
ssh -p 29418 myserver gerrit query --patch-sets topic:mytopic AND project:myprojectgrep ref: | sed s%\ \ \ \ ref:\ %%xargs -r -n 1 get_n_tag_patchset.shget_n_tag_patchset.sh looks like this:git fetch --recurse-submodules=no origin $1git tag -f $1 FETCH_HEADI merged the first three points together in one command line:
ssh -p 29418 myserver gerrit query --patch-sets topic:mytopic AND project:myproject | grep ref: | sed s%\ \ \ \ ref:\ %% | xargs -r -n 1 get_n_tag_patchset.sh
So I end up with all the patch sets of the desired topic in my local repo, each with a tag on it.
Doing this for all of my submodules (where 'myproject' has to be replaced to match the submodule, of course) will do the rest. :-)
The latest GitMinutes episode (July 2014) mentions that, and Luca Milanesio, a seasoned Gerrit contributor, details it in its blog post:
With the forthcoming support of multi-repositories atomic commits in Gerrit, it will be possible to merge multiple changes on multiple repositories at the same time for a single topic.
This feature is not ready yet but coming hopefully in the near future and Google Gerrit Team developers and contributors are working on it.
This is not there yet in Gerrit 2.9 though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With