I have rolled a Gerrit instance for my organization, got LDAP
authentication going, and have imported some working copies of Android,
The working copies do not include references to the upstream (remote)
branches, however. For a given project, say frameworks/base, what I'd
hope to achieve is:
git branch -r
# See Google branches
git rebase # to a Google branch.
git push # back to my Gerrit instance.
How do I ensure that my local git repos are aware of the upstream
projects, as above? Do I need to mirror the AOSP content, locally?
I have tried reading some documentation, and also simply adding a remote
delcation for Google to my manifest xml. Push replication is covered
widely, but this is not my use case, as I want to track remote branches,
not push my local changes back up to them.
As far as I know, most teams use a script which will pull down the Google version of Android and push it directly to their Gerrit servers, bypassing review. There is no setting in the manifest xml file which can help with this.
Some Android shops want to use a different namespace for the upstream branches and tags. For example, rather than
froyo branches and the
android-4.1.1_r6 tag, they might prefix everything with
Other shops prefix their internal branches and tags in a similar fashion.
Your script to do this work will look similar to this (untested). First set up a local repo clone from upstream using the
# this only needs to be ran once, or for any new repositories added to repo: repo forall -c \ 'git remote add local_server ssh://path/to/local/gerrit:29418/$REPO_PROJECT' # fetch changes repo forall -c 'git fetch' # push to your local Gerrit server repo forall -c 'git push local_server refs/*:refs/external/*'
You can, of course, use a cron job to automate this script. Once this is in place, when developers run
git branch -r they will see the origin/external/blah branches from upstream and can rebase based on those branches.