Auto merge from release branch to master?

1,305 views
Skip to first unread message

Ole Traveler

unread,
Jun 15, 2012, 11:21:11 AM6/15/12
to repo-d...@googlegroups.com
Let say I have a release branch and I push a commit to that release branch and it gets reviewed.

I now want that commit to be reflected in master.  Is there a way to do that without having that commit go through code review again?

thanks,
OT

Matthias Sohn

unread,
Jun 15, 2012, 11:31:28 AM6/15/12
to Ole Traveler, repo-d...@googlegroups.com
2012/6/15 Ole Traveler <wilh...@gmail.com>

Let say I have a release branch and I push a commit to that release branch and it gets reviewed.

I now want that commit to be reflected in master.  Is there a way to do that without having that commit go through code review again?

merge the accepted change into master locally and push it to refs/heads/master.
This shortcuts code review but requires that you have the push privilege.

--
Matthias

Magnus Bäck

unread,
Jun 15, 2012, 11:31:57 AM6/15/12
to Repo and Gerrit Discussion
Yes, but not within Gerrit itself. You can write a script that picks
up new commits on the release branch and either cherrypicks them to
the master branch or (usually preferable) merges the release branch to
master. The user that the script runs as could be given sufficient
permissions to bypass code review and push the commits straight to the
branch.

--
Magnus Bäck
ba...@google.com

Ole Traveler

unread,
Jun 15, 2012, 12:10:57 PM6/15/12
to repo-d...@googlegroups.com, Ole Traveler
I get this message after merging locally and pushing to gerrit repo.

! [remote rejected] HEAD -> refs/for/master (no new changes)

Current version is 2.3-rc0 

Luciano Carvalho

unread,
Jun 15, 2012, 12:13:55 PM6/15/12
to Ole Traveler, repo-d...@googlegroups.com

Do you intent to push it for review again?

Magnus Bäck

unread,
Jun 15, 2012, 12:29:03 PM6/15/12
to repo-d...@googlegroups.com
On Fri, Jun 15, 2012 at 12:10 PM, Ole Traveler <wilh...@gmail.com> wrote:

> I get this message after merging locally and pushing to gerrit repo.
>
> ! [remote rejected] HEAD -> refs/for/master (no new changes)

That's probably because the merge was a fast-forward merge. Those
can't be reviewed. If you want to push a merge for review you need a
merge commit. You can force one to be created with the --no-ff option
to "git merge". If you don't want the merge commit you can bypass the
review by pushing to refs/heads/master rather than refs/for/master.

--
Magnus Bäck
ba...@google.com

Thomas Broyer

unread,
Jun 16, 2012, 4:42:05 AM6/16/12
to repo-d...@googlegroups.com
And couldn't that script run as a change-merged hook?

Magnus Bäck

unread,
Jun 16, 2012, 9:17:00 AM6/16/12
to repo-d...@googlegroups.com
Sure, I suppose it could. I usually prefer stream-events as it allows
non-privileged users to automate processes.

--
Magnus Bäck
ba...@google.com

Lundh, Gustaf

unread,
Jun 19, 2012, 6:40:39 AM6/19/12
to Ole Traveler, repo-d...@googlegroups.com

Since you are using 2.3-rc0 this could also be a bug where Gerrit does not allow pushes of the same commit to new branches. This was due to the “no new changes”-detection did not take into account that the commit could be aimed for a different branch. If this was the issue, it would have been fixed in this change (2.4):

 

https://gerrit-review.googlesource.com/#/c/34460/

 

/Gustaf

--

Urs Wolfer

unread,
Jun 23, 2015, 2:17:09 PM6/23/15
to repo-d...@googlegroups.com
I know this is a quite old thread, but I'm interested if anybody has got an automated solution working?

I'm wondering if it would be worth developing a Gerrit plugin which automates this workflow. Some thoughts:
* after submit, branch gets merged automatically into any branch which contains parent commit of submitted change
* auto-merge could be disabled via settings for specified source- / target-branches (e.g. useful for feature-branches which you do not want to merge back into source-branch)
* merge-results are posted as comments in change (this way manual merge could be done by owner if auto-merge fails)

Any comments?

Bye
urs

Nasser Grainawi

unread,
Jun 23, 2015, 2:49:07 PM6/23/15
to Urs Wolfer, repo-d...@googlegroups.com
We have an internal solution that cherry-picks changes to other branches when they merge, but it works a little differently from how you imagined it below.

We're looking at making it more of a pluggable feature soon, so we might be able to upstream the framework of it in the future, but currently it's strongly tied to our homegrown bug tracker and a few other homegrown tools.

Nasser

--
---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

Edwin Kempin

unread,
Jun 24, 2015, 3:18:45 AM6/24/15
to Nasser Grainawi, Urs Wolfer, Repo and Gerrit Discussion
2015-06-23 20:49 GMT+02:00 Nasser Grainawi <nas...@codeaurora.org>:
We have an internal solution that cherry-picks changes to other branches when they merge, but it works a little differently from how you imagined it below.

We're looking at making it more of a pluggable feature soon, so we might be able to upstream the framework of it in the future, but currently it's strongly tied to our homegrown bug tracker and a few other homegrown tools.

Nasser

On Jun 23, 2015, at 12:17 PM, Urs Wolfer <u.wo...@gmail.com> wrote:

I know this is a quite old thread, but I'm interested if anybody has got an automated solution working?

I'm wondering if it would be worth developing a Gerrit plugin which automates this workflow. Some thoughts:
* after submit, branch gets merged automatically into any branch which contains parent commit of submitted change
* auto-merge could be disabled via settings for specified source- / target-branches (e.g. useful for feature-branches which you do not want to merge back into source-branch)
* merge-results are posted as comments in change (this way manual merge could be done by owner if auto-merge fails)

Any comments?
Would be nice to have this as a plugin :-)

vinay pal

unread,
May 3, 2018, 2:27:36 AM5/3/18
to Repo and Gerrit Discussion
Hi Nasser,

I am also looking for similar plugin for gerrit auto propagation to branches.
Is that available as plugin or any repo that I can use?

Thanks,
Vinay
Reply all
Reply to author
Forward
0 new messages