A Gerrit Instance that Can Rebase Projects to Google AOSP?

I have rolled a Gerrit instance for my organization, got LDAP
authentication going, and have imported some working copies of Android,
manually. Cool.

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:

  • Add github library as dependency to Android-Studio project
  • Android studio and git
  • Should I create a branch for the free version of my android app?
  • alternative to git-repo ( aosp repo )
  • Tortoise SVN suddenly stopped showing “exclamation” icon or “differences”
  • Rollback using repo command?
  • 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.

    Thank you!

  • How does Mercurial work with many developers?
  • bitbucket how to return branch from “merged” into “active”
  • Android+Eclipse project sharing via SVN?
  • How to delete a remote branch using Git?
  • Cherry picks from gerrit overwritten by repo sync
  • Pushing one git branch requires a pull on another?
  • One Solution collect form web for “A Gerrit Instance that Can Rebase Projects to Google AOSP?”

    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 master and froyo branches and the android-4.1.1_r6 tag, they might prefix everything with externalexternal/master, external/froyo, and external/android-4.1.1_r6.

    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 --mirror option.

    # 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.

    Git Baby is a git and github fan, let's start git clone.