Advice on creating branches on a AOSP mirror.

398 views
Skip to first unread message

Ne0

unread,
Aug 16, 2013, 6:03:22 AM8/16/13
to repo-d...@googlegroups.com
I have an AOSP mirror set up and i want branch from a particular Android build and I'm looking for advice on how to do this.

Here is what i think i should do it but i have hit issues.

repo init -u git@development:android.git/platform/manifest.git -b android-4.2.2_r1.2 # Success
repo sync # Success
repo forall -c "git branch my-4.2.2;git push --all development" # Success
cd .repo/manifests/ # Success
git branch my-4.2.2 # Success
nano default.xml
  <remote  name="development"
           fetch=".." />
  <default revision="my-4.2.2"
           remote="development"
git commit -a -m "Creating my own branch my-4.2.2"  # Success
git push --all development # Success
cd ../../ # Success
repo init -u git@development:android.git/platform/manifest.git -b my-4.2.2 # Success
repo sync # Success
cd build/ # Success
git branch -t my-4.2.2-changes development/my-4.2.2 # Success
nano envsetup.sh
# Making a change!
git commit -a -m "Made a change"  # Success
git push --all development  # Success
cd ../ # Success
repo sync # Success
cd build # Success
gitg # FAIL - Local head at wrong position.

After doing all this I check where sync has left the local head and its not checked out to the development/my-4.2.2 branch but an m/my-4.2.2 branch that appears to be at the commit behind development/my-4.2.2. I'm not sure where m/my-4.2.2 came from or why repo is not tracking the remote branch.

The hope is that the development server can do scripted nightly builds on this new branch to ensure that the few contributors that are working on the branch have not introduced any errors in the build.

Does anyone know where I have gone wrong or know of better way of achieving what I am trying to do?   

Ne0

unread,
Aug 16, 2013, 9:24:25 AM8/16/13
to repo-d...@googlegroups.com
On closer inspection of .repo/manifests/default.xml there is a nested revision tag on the build project.

So the test I ran just happened to be on the only project that had a separate revision! I'm very glad I caught that little bug now.

Still, if anyone thinks there is better way branch an AOSP build then please let me know.

Magnus Bäck

unread,
Aug 16, 2013, 9:40:59 AM8/16/13
to repo-d...@googlegroups.com
On Friday, August 16, 2013 at 06:03 EDT,
Ne0 <liamjam...@googlemail.com> wrote:

> I have an AOSP mirror set up and i want branch from a particular
> Android build and I'm looking for advice on how to do this.
>
> Here is what i think i should do it but i have hit issues.
>
> repo init -u git@development:android.git/platform/manifest.git
> -b android-4.2.2_r1.2 # Success
> repo sync # Success
> repo forall -c "git branch my-4.2.2;git push --all development" # Success
> cd .repo/manifests/ # Success
> git branch my-4.2.2 # Success
> nano default.xml
> <remote name="development"
> fetch=".." />
> <default revision="my-4.2.2"
> remote="development"
> git commit -a -m "Creating my own branch my-4.2.2" # Success
> git push --all development # Success
> cd ../../ # Success
> repo init -u git@development:android.git/platform/manifest.git -b my-4.2.2 #
> Success
> repo sync # Success

This... doesn't add up to me. You created a my-4.2.2 branch in the
manifest and updated the default revision to use that branch for all
gits (the android-4.2.2_r1.2 manifest uses the default revision
everywhere). I don't see how you can switch to that manifest branch
and run 'repo sync' without it complaining about a missing my-4.2.2
branch in every git. Did you forget to mention one of the steps you
did?

> cd build/ # Success
> git branch -t my-4.2.2-changes development/my-4.2.2 # Success
> nano envsetup.sh
> # Making a change!
> git commit -a -m "Made a change" # Success
> git push --all development # Success
> cd ../ # Success
> repo sync # Success
> cd build # Success
> gitg # FAIL - Local head at wrong position.

I'm not familiar with gitg. Perhaps it doesn't like the symlinks in the
.git directories?

> After doing all this I check where sync has left the local head
> and its not checked out to the development/my-4.2.2 branch but an
> m/my-4.2.2 branch that appears to be at the commit behind
> development/my-4.2.2. I'm not sure where m/my-4.2.2 came from or
> why repo is not tracking the remote branch.

You never checked out the my-4.2.2-changes branch, so your commit was
made on top of the detached head. When you ran 'repo sync', the state
of the git was backed out to what the state should be according to the
manifest (i.e. a detached head based on my-4.2.2). The m/my-4.2.2 ref
is a symlink to the branch that the manifest points to, so in this case
you should be seeing this:

$ git branch -a | grep 'm/my-4.2.2'
remotes/m/my-4.2.2 -> development/my-4.2.2

Because of this, 'git rev-parse m/my-4.2.2' will always be the same as
'git rev-parse development/my-4.2.2'.

[...]

--
Magnus Bäck
ba...@google.com

Ne0

unread,
Aug 16, 2013, 11:02:35 AM8/16/13
to repo-d...@googlegroups.com
I think I have isolated the issue (see my previous post, you may have been responding at the time!), but in case it helps any one else I will fill in some gaps.



This... doesn't add up to me. You created a my-4.2.2 branch in the
manifest and updated the default revision to use that branch for all
gits (the android-4.2.2_r1.2 manifest uses the default revision
everywhere). I don't see how you can switch to that manifest branch
and run 'repo sync' without it complaining about a missing my-4.2.2
branch in every git. Did you forget to mention one of the steps you
did?

I don't think so, I did a repo forall -c "git branch my-4.2.2;git push --all development", before syncing, so all projects had that branch. (It was in my OP) 
 
> cd build/ # Success
> git branch -t my-4.2.2-changes development/my-4.2.2 # Success
> nano envsetup.sh
> # Making a change!
> git commit -a -m "Made a change"  # Success
> git push --all development  # Success
> cd ../ # Success
> repo sync # Success
> cd build # Success
> gitg # FAIL - Local head at wrong position.

I'm not familiar with gitg. Perhaps it doesn't like the symlinks in the
.git directories?
 
I didn't explain that very well, I use to gitg (graphical representation of a git project) to view git history and head positions, I find it easier then the command line equivalent. (The issue was in the repo default manifest xml file).



> After doing all this I check where sync has left the local head
> and its not checked out to the development/my-4.2.2 branch but an
> m/my-4.2.2 branch that appears to be at the commit behind
> development/my-4.2.2. I'm not sure where m/my-4.2.2 came from or
> why repo is not tracking the remote branch.

You never checked out the my-4.2.2-changes branch, so your commit was
made on top of the detached head.

Good spot! That was a line I did actually forget to put into the OP.

git checkout my-4.2.2-changes
# make changes (This is a long way around, but i was testing a real life situation)
git checkout my-4.2.2
git merge my-4.2.2-changes
git branch -d my-4.2.2-changes # Stopping the temp branch being pushed up stream
# do git push

When you ran 'repo sync', the state
of the git was backed out to what the state should be according to the
manifest (i.e. a detached head based on my-4.2.2). The m/my-4.2.2 ref
is a symlink to the branch that the manifest points to, so in this case
you should be seeing this:

$ git branch -a | grep 'm/my-4.2.2'
  remotes/m/my-4.2.2 -> development/my-4.2.2

Because of this, 'git rev-parse m/my-4.2.2' will always be the same as
'git rev-parse development/my-4.2.2'.

Thanks for the explanation, that does clear up my confusion about that m/my-4.2.2 branch.
 

[...]

--
Magnus Bäck
ba...@google.com


Thanks for your help. I realise now that if I had posted to entire terminal log and edited default.xml file, my query would have been clearer and the problem easier to spot. 

No doubt you would have spotted 

  <project path="build" name="platform/build" groups="pdk" revision="f03d227b09d0bc3e1b2342811d5106aa7749fad0" >
    <copyfile src="core/root.mk" dest="Makefile" />
  </project>

which was the real cause to my confusion and problems!

Thanks again for your help.

Magnus Bäck

unread,
Aug 16, 2013, 11:49:59 AM8/16/13
to repo-d...@googlegroups.com
On Friday, August 16, 2013 at 11:02 EDT,
Ne0 <liamjam...@googlemail.com> wrote:

> > This... doesn't add up to me. You created a my-4.2.2 branch in the
> > manifest and updated the default revision to use that branch for all
> > gits (the android-4.2.2_r1.2 manifest uses the default revision
> > everywhere). I don't see how you can switch to that manifest branch
> > and run 'repo sync' without it complaining about a missing my-4.2.2
> > branch in every git. Did you forget to mention one of the steps you
> > did?
>
> I don't think so, I did a repo forall -c "git branch my-4.2.2;git push
> --all development", before syncing, so all projects had that branch.
> (It was in my OP)

Yes, that's right. My brain apparently filtered out the 'repo forall'
tokens.

> > You never checked out the my-4.2.2-changes branch, so your commit
> > was made on top of the detached head.
>
> Good spot! That was a line I did actually forget to put into the OP.
>
> git checkout my-4.2.2-changes
> # make changes (This is a long way around, but i was testing a real
> life situation)
> git checkout my-4.2.2
> git merge my-4.2.2-changes
> git branch -d my-4.2.2-changes # Stopping the temp branch being pushed up
> stream
> # do git push

I'd rebase the topic into the upstream branch rather than merging it.

[...]

> Thanks for your help. I realise now that if I had posted to entire
> terminal log and edited default.xml file, my query would have been
> clearer and the problem easier to spot.
>
> No doubt you would have spotted
>
> <project path="build" name="platform/build" groups="pdk"
> revision="f03d227b09d0bc3e1b2342811d5106aa7749fad0" >
> <copyfile src="core/root.mk" dest="Makefile" />
> </project>
>
> which was the real cause to my confusion and problems!

I did check whether there was any git with the revision attribute
set in the manifest, but I forgot that android-4.2.2_r1.2 is both
a tag and a branch and the manifest I got with
'git show android-4.2.2_r1.2:default.xml' was from the tagged
commit and you based your work on the branch with the same name
where the build git overrides the reivsion.

--
Magnus Bäck
ba...@google.com
Reply all
Reply to author
Forward
0 new messages