Green Mind Green Mind - 3 years ago 168
Git Question

refs/changes/* not replicated from gerrit to bitbucket

I set up my gerrit server to replicate all changes in my project to bitbucket using HTTPS.

I can get the submitted (merged) changes in any branch (master and others) to replicate just fine. However, upstanding changes which are waiting for code review, do not get replicated. On replication.log file I see this line:

[2017-07-18 15:32:00,064] [] Push to https://***@bitbucket.org/***/***.git references: [RemoteRefUpdate[remoteName=refs/changes/12/12/1, NOT_ATTEMPTED, (null)...****, srcRef=refs/changes/12/12/1, message=null]]


I looked at the source code and it seems like NOT_ATTEMPTED means that "this ref is not configured to be replicated".

/** The ref is not configured to be replicated. */
NOT_ATTEMPTED,


My configuration is very simple, I only define a remote url and project:

[remote "bitbucket"]
url = https://***@bitbucket.org/***/${name}.git
projects = ***


Alternatively, I tried to specifically add a 'push' setting for refs/changes:

[remote "bitbucket"]
url = https://***@bitbucket.org/***/${name}.git
projects = ***
push = +refs/changes/*:refs/changes/*


However, this had no affect.

Any ideas?

Answer Source

Apparently my reviews were replicated to bitbucket, but I did not see them on bitbucket UI, since the UI only shows branches which are pushed under refs/heads/*, while gerrit reviews are pushed under refs/changes/*.

I solved this by adding this line to replication.config:

push = refs/changes/*:refs/heads/review/*

This turns the gerrit change branches into 'real' branches which are displayed on bitbucket UI and can be easily accessed.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download