Gerrit and Repo, the Android Source Management Tools
Posted:
Monday, November 3, 2008
A couple weeks ago, we announced the Android open source release. Beside it, we silently released the tools that we wrote in order to make handling a large multi-repository project manageable in git. If you had a chance to look through the Android open source website, you'll notice references to a tool called repo. Why did we write this? With approximately 8.5 million lines of code (not including things like the Linux Kernel!), keeping this all in one git tree would've been problematic for a few reasons:
* We want to delineate access control based on location in the tree.
* We want to be able to make some components replaceable at a later date.
* We needed trivial overlays for OEMs and other projects who either aren't ready or aren't able to embrace open source.
* We don't want our most technical people to spend their time as patch monkeys.
The repo tool uses an XML-based manifest file describing where the upstream repositories are, and how to merge them into a single working checkout. repo will recurse across all the git subtrees and handle uploads, pulls, and other needed items. repo has built-in knowledge of topic branches and makes working with them an essential part of the workflow.
The gerrit code review tool is based off of rietveld. Gerrit is itself split into two components: Half that runs on Google App Engine to provide front-end web service, and half that runs on a machine to handle attempted merges into the "upstream" branch, and the various code review branches. When we integrate the auto-builders into the system, that will also be handled by Gerrit.
We have a workflow diagram that shows how code gets into the system for Android. If you're looking to switch to git, but don't want to lose the ability for multiple people to commit into an upstream tree, this is one solution for you to consider. Interested? Find us at [email protected]

Can you provide a link to the Gerrit source code? I'm having trouble finding it.
ReplyDeletehttp://code.google.com/p/gerrit/ has the necessary details.
ReplyDeleteMonday I'm planning on releasing the first version of Gerrit2, and will post a download bundle in the featured downloads area.
Hi,
ReplyDeleteA little FAQ on repo will help a lot.
1) How to switch branches?
2) How to revert all changes?
3) How to get list of available branches?
4) How to get graph of branches?
And at last why not using Subversion?! repository size is not so huge after all... and not so many developers need full history of changes in repository. Subversion has better GUI in compare to GIT. TortoiseSVN GUI cost more then any size (distributed sources) benefit provided by GIT...
Can be created alternative version control for android?
> A little FAQ on repo will help a lot.
ReplyDeleteMost of the repo documentation is actually available online, once a repo client has been initialized with "repo init" you can use "repo help".
But you may also want to see Using repo and Git.
> 1) How to switch branches?
repo checkout otherbranch> 2) How to revert all changes?
repo sync -d
repo abandon yourbranch> 3) How to get list of available branches?
repo branches
> 4) How to get graph of branches?
repo forall -c 'gitk &'
Though I would not recommend that in Android, as it would open ~140 gitk windows.
> And at last why not using Subversion?!
Subversion is not a distributed version control system. It makes it very difficult for 3rd parties to take the Android platform and build products on top of it. With Subversion, or any other non-distributed version control system, non-committers are 2nd class citizens who don't have the same level of functionality as the blessed committers/maintainers of the project.
We very much want to make Android available for everyone to use, extend, and build on top of. Open source allows rapid innovation to occur, and to open up markets that didn't exist before. Distributed version control tools are the next great thing for open source, as it ensures these innovators are really free to access the code, modify it, and redistribute those modifications.
> repository size is not so huge after all...
Repository size has nothing to do with the decision of Subversion vs. Git vs. anything else. The decision to use a distributed version control system was about freedom to innovate.
> and not so many developers need full history of changes in repository.
I guess you have never lived with a distributed version control system before. I think I'm looking through ancient history at least once, maybe twice a day. Its much quicker when its local.
> Subversion has better GUI in compare to GIT.
That may be true, but the feature set of Git is much more powerful, especially for those who aren't in that "blessed inner circle" that maintain the repositories at source.android.com.
> TortoiseSVN GUI cost more then any size (distributed sources) benefit provided by GIT...
That may be your opinion, it sounds like GUI matters more to you than freedom to innovate.
> Can be created alternative version control for android?
I'm not sure what you mean.
Are you suggesting that Android switch to Subversion, or another non-distributed version control system? That would never happen, due to the loss in freedom for people building products with the Android platform.
Are you suggesting that Android switch to another distributed version control system, such as Bazaar or Mecurial? That also won't happen. Most of the distributed version control systems offer roughly equivalent feature sets. Android has been on Git since its release in October, 2008. There is nothing to be gained by switching now, and there are *many* teams already building products off the Git based sources. Any sort of switch would only cause major disruption for all players, and would provide no tangible benefits at this time.
@Shawn Pierce.
ReplyDeleteyour link to "Using Repo and Git" (http://source.android.com/download/using-repo) leads to a blank page.
@marcthenarc,
ReplyDeleteI talked to Shawn - Try http://source.android.com/source/git-repo.html