How to setup local android source tree on Gerrit server?

1,232 views
Skip to first unread message

Rafeah Rahim

unread,
Mar 6, 2013, 10:15:32 PM3/6/13
to repo-d...@googlegroups.com
Hi All,

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.

Q1: How do I keep my local mirror updated?
I only manage to create the local mirror using the website http://source.android.com/source/downloading.html as reference
$ mkdir aosp_mirror
$ cd aosp_mirror
$ repo init -u https://android.googlesource.com/mirror/manifest --mirror
$ repo sync
Let say if there are new updates on the

https://android.googlesource.com/, I just go to
aosp_mirror directory and just execute "repo sync" command?

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?

Q3: How do I create a new branch on every source tree and then push it to gerrit?

Thanks!





Magnus Bäck

unread,
Mar 7, 2013, 8:49:45 AM3/7/13
to repo-d...@googlegroups.com
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.

> Q1: How do I keep my local mirror updated?
> I only manage to create the local mirror using the website
> http://source.android.com/source/downloading.html as reference
> $ mkdir aosp_mirror
> $ cd aosp_mirror
>
> $ repo init -u https://android.googlesource.com/mirror/manifest --mirror
> $ repo sync
> Let say if there are new updates on the
> https://android.googlesource.com/, I just go to
> aosp_mirror directory and just execute "repo sync" command?

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

Rafeah Rahim

unread,
Mar 25, 2013, 10:56:33 PM3/25/13
to repo-d...@googlegroups.com
Thanks Magnus for your kind reply. Sorry for the late response as I just came back from vacation.

Like you mentioned there many discussion about setting up local aosp mirror, it seems that I wasn't clear about the whole mirroring concept and thought they did not answer my questions.


--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to a topic in the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/repo-discuss/YSTKck6gFDA/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to repo-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Reply all
Reply to author
Forward
0 new messages