On Wednesday, March 06, 2013 at 21:15 CST,
Rafeah Rahim <
rafeah....@gmail.com> wrote:
> I am totally new to git and gerrit tool, so bare with me if you find
> my questions to be very trivial.
>
> I am trying to setup a local mirror from aosp on my gerrit server so
> that the developer can sync the code locally and not go to
>
>
https://android.googlesource.com for code sync and download.
This is a common thing to do and it has been covered on this list
several times before. You can probably find useful threads in the
archives.
Yes.
> Q2: How do I populate the AOSP source tree on gerrit?
> I googled around, it seems that I need to create a new project base
> for each git repo.
> Is there an automated way to set it up on gerrit and how do I know
> what is the correct project name to setup on Gerrit?
You mean how to create the projects that you've just downloaded on the
Gerrit server and populate them? Use the create-project SSH command to
batch-create each project. You can obtain the project names from the
manifest file. As for pushing, see below.
> Q3: How do I create a new branch on every source tree and then push it
> to gerrit?
To create a new branch in a remote git repository, push the commit you
want to see as the starting point of the branch to refs/heads/<name>,
where <name> is the desired name of the new branch. For example:
git push ssh://gerrithost/platform/build origin/master:refs/heads/dev
This assumes that you've cloned the git in question, e.g. by running
'repo sync' against your mirror. It also requires you to have sufficient
permissions in the git. You'll need at least Create Reference for
refs/heads/dev (though you'd typically make sure you have Create
Reference for refs/heads/* if you want to be able to create branches
with any name).
This takes care of a single git. To do this for all gits, the
'repo forall' command is useful. It allows you to run a command for
every git and sets up environment variables that you can use to
parameterize the command. Example:
repo forall -c 'git push ssh://gerrithost/$REPO_PROJECT \
origin/master:refs/heads/dev'
Note that not all gits in an Android manifest necessarily use the same
branch as the name of the manifest branch. You may find the $REPO_RREV
and $REPO_LREV variables useful.
Oh, and wildcards are supported if you want to push more than one branch
at a time, so
git push ssh://gerrithost/platform/build refs/heads/*:refs/heads/*
would be a valid way of pushing all branches.
--
Magnus Bäck
ba...@google.com