On Wednesday, November 14, 2012 at 09:37 EST,
Hugo Soares <
hugofrede...@gmail.com> wrote:
> I'm searching for this for sometime now... If this is not the right
> group, could you point me the right one?
You've come to the right place.
> I was able to clone the Android source as a mirror on my server,
> and clients can download code from the server fine now.
> We are trying to make a customized version of Android based on
> gingerbread release, so I mirrored with:
>
> repo init -u
https://android.googlesource.com/platform/manifest
> --mirror -b android-2.3.6_r1
> repo sync
I doubt the -b option makes any sense here. If you drop it your problem
will go away, and since you're mirroring the whole source tree anyway
(including all branches and tags) it doesn't serve any purpose.
That said, the behavior you're seeing is probably a bug in Repo.
> and clients can now download from mirror as:
>
> repo init -u ssh://<my_server_ip>/<path_to_mirror>/platform/manifest.git
> -b android-2.3.6_r1
>
> Since our team is very small, we won't have a code review tool as
> gerrit,
Having a small team doesn't preclude code reviews. Many of the positive
effects of having code reviews are unrelated to the team size.
> neither our server is a build server (builds are going to be made in
> client machines)... So what we need is a way to sync our local changes
> with our local mirror, so any new client could make a git clone and
> see the latest updates.
>
> Now, my first problem is: I can't clone a git from my mirror with git
> clone...
>
> ~$ git clone
> ssh://<my_server_ip>/<path_to_mirror>/platform/packages/apps/Settings
> Cloning into 'Settings'...
> remote: Counting objects: 61117, done.
> remote: Compressing objects: 100% (18379/18379), done.
> remote: Total 61117 (delta 32718), reused 60987 (delta 32599)
> Receiving objects: 100% (61117/61117), 77.95 MiB | 24.63 MiB/s, done.
> Resolving deltas: 100% (32718/32718), done.
> error: Trying to write non-commit object
> 4c568da55f74d1aee61a2952477b0443aeea6696 to branch HEAD
> fatal: Cannot update the ref 'HEAD'.
This SHA-1 is the android-2.3.6_r1 tag, and Git wants HEAD to point
to branches. As indicated earlier, just drop the -b option when you
initialize the mirror.
> My second problem is that I don't know the right way to push a change
> to my local mirror, do I have to use --mirror flag?
Pushing changes with the setup you've described isn't any different from
pushing any type of changes with Git.
> Also, how do I make a branch based on gingerbread on my mirror, so
> clients can repo init, pull/push as:
>
> repo init -u ssh://<my_server_ip>/<path_to_mirror>/platform/manifest.git -b
> MY_BRANCH
You create Git branches by pushing a commit (or a ref to a commit) to
the desired name of the branch.
git push <push-url> <some-commit-reference>:refs/heads/<branch-name>
Again, this isn't specific to Repo. In your case it can look like this:
git push ssh://<my_server_ip>/<path_to_mirror>/platform/manifest.git \
android-2.3.6_r1:refs/heads/my-gingerbread-development-branch
(I don't remember if Git translates the tag name to a commit in
this case. You should probably use android-2.3.6_r1^{} instead of
android-2.3.6_r1. It might not be necessary but won't hurt.)
This needs to be done for every git. The "repo forall" tool can help you
with that. This assumes that there actually is an android-2.3.6_r1 tag
in each git. I'm guessing that's the case, but it's safer to use what's
actually listed in the manifest. The "repo forall" command defines a
number of environment variables that you can use in the commands that
are executed in each git. In this case you'd want to use $REPO_LREV.
repo forall -c 'git push \
ssh://<my_server_ip>/<path_to_mirror>/platform/manifest.git \
$REPO_LREV:refs/heads/my-gingerbread-development-branch'
I have a vague recollection that the "repo forall" command includes the
manifest git when it iterates over the gits, but othewise you need to
push the branch in the manifest git too. You also need to make a commit
in the manifest branch to adjust the default revision in default.xml.
Otherwise people will continue to sync the original Gingerbread code
even though they initialize their workspace with your branch since it's
the manifest that defines which version is synced in each git.
I have written about this topic a few times before. You might want to
search the list archives.
--
Magnus Bäck
ba...@google.com