2

I am trying to integrate AOSP device changes into a standard AOSP, local mirror. This is a bit confusing but I will try to be as clear as possible.

  1. I created a local mirror of the AOSP repo on a server (different local computer)

  2. The vendor patches are based on a tag "android-4.3_r2.1". So I initialized a local repo and modified the manifest file.

repo init -u ssh://localserver/git/aosp/mirror/platform/manifest -b android-4.3_r2.1

Changed .repo/manifest.xml as follows:

  <remote  name="aosp"
           fetch="ssh://localserver/git/aosp/mirror" />  
  <default revision="refs/tags/android-4.3_r2.1"
           remote="aosp"
           sync-j="8" />
  1. "repo sync" completed successfully. Applied the patch provided by the vendor. This created a branch "vendor" for each git project modified and/or added by the patch.

  2. Now I have a repo based on tag "android-4.3_r2.1", some projects have a branch "vendor". None of the projects have a "master" branch!

How do you bring all this together to make a workable repository? I am still learning. Would this be correct?

repo checkout refs/tags/android-4.3_r2.1
repo forall -c git checkout -b master
repo forall -c git merge vendor
  1. The last issue is using repo to push the changes to our local mirror. It appears that repo upload only works if you are using a gerrit server. Is this really necessary?

TIA

1 Answers1

3

There's no need to change the manifest to point to your Git server. The .. URL that's in the android-4.3_r2.1 manifest means that the git URLs will be relative to the manifest's URL. In other words, if you clone the manifest from your local mirror the remaining gits will also be fetched from your local mirror.

When you're talking about vendor and master branches I'm assuming you're talking about local branches (i.e. visible in the git branch output). In this answer I'm going to ignore those and only talk about branches on the remote. They're the ones that matter. With Repo you don't get any local branches by default and the name of any local branches is up to every individual.

I'm pretty sure every single one of your projects have a master branch – on the "aosp" remote. I suggest you pick another branch name for your adaptations and the patches you get from your vendor. In fact, it's wise to choose a different namespace altogether. If your company or organization is named Acme you can place all your branches under acme/, so acme/master, acme/vendor, and so on. (I prefer doing it the other way around, i.e. stuffing the upstream branches into separate namespaces, like aosp/ and caf/. That way the branches that you actually work on don't have a prefix and you can have multiple upstreams.)

Getting all this into a working repository will involve updating the manifest to point to the branches on which you're working. If you push your local vendor branch to acme/vendor, then the manifest should point to acme/vendor. It's up to you whether to create an acme/vendor branch in every single git and change the default revision in the manifest or if you want to push the branch only where it actually needs to exist and selectively override the revision for those gits.

The latter obviously requires you to update the manifest every time you branch a git. On the other hand you won't be littering all gits with unnecessary branches, and you can quickly glance over the manifest file and see which gits are branches and which ones come straight from the upstream. Also, grabbing a new release from the upstream will likely require more work if you branch all gits. Keep in mind that the upstream might switch to another branch for a git so you may get non-fast forward updates even for gits that you haven't touched. The example below shows how how can't update acme/master from 1.2.3 to 1.2.4 as a fast forward, so you'll either have to make a non-fast forward update (generally not recommended), merge from 1.2.3 into acme/master (possible resulting and conflicts and forever making fast forward updates impossible), or create a new branch based off of 1.2.4.

         -----1.2.3 (acme/master)     -----1.2.4
        /                            /
 ------------------------------------

Don't forget to branch the manifest. Repo handles the manifest git in a special way where it assumes that all changes are made on the branch named "default". So, just edit the manifest file, commit your changes, and push it with e.g. git push origin HEAD:refs/heads/acme/master. After that you can initialize a new workspace with repo init -u ... -b acme/master.

Yes, repo upload is for use with Gerrit, which you certainly don't need (though I recommend it for its code review features). You can just push with Git like you normally would do. I see you've already found the repo forall command which is quite useful.

Magnus Bäck
  • 10,535
  • 3
  • 40
  • 57
  • What is the easiest way to move the existing branches to a new namespace? – Allen Curtis Oct 12 '14 at 05:03
  • I was thinking about creating a new manifest with all the references updated. It is not obvious when a directory is a new project that needs to be branched. Wouldn't it be easier to just branch everything using repo and not worry about it? – Allen Curtis Oct 12 '14 at 05:07
  • To move branches, I'd assume that `git branch -m` in the bare git on the server works fine. You can also push from a clone of the git, but it would have to be one push to create the new branch and one to delete the old one (`git push origin refs/heads/foo:refs/heads/acme/foo && git push origin :refs/heads/foo`). Wildcards work too (`origin/*:refs/heads/acme/*`). – Magnus Bäck Oct 12 '14 at 14:20
  • Sure, branching everything is fine too. It's mostly a matter of preference. If you consistently branch all gits there will be fewer manifest updates, but grabbing a new release from the upstream will be more work. Keep in mind that the upstream might switch to another branch for a git so you may get non-fast forward updates. Nothing that can't be solved of course, but it may require manual attention. I'll update the answer slightly to mention this too. – Magnus Bäck Oct 12 '14 at 14:25