Loading...

repo-discuss@googlegroups.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: Push all GIT branches to Gerrit Emmanuel Grumbach Thu Dec 24 10:00:17 2009

Of course I forgot to push tags here...
Emmanuel Grumbach
[EMAIL PROTECTED]


On Thu, Dec 24, 2009 at 13:36, Emmanuel Grumbach <[EMAIL PROTECTED]>wrote:

> Hi all,
>
> recently I had to push a whole Android project to Gerrit. I downloaded it
> with repo but not from Gerrit and wanted to push it to Gerrit including all
> the branches. The main issue was that I repo would create only one GIT
> branch in each repository, the branch that matches the manifest.
>
> Finally I wrote this script:
>
> #!/bin/bash -f
>
> username=MYNAME
> gerrit_srv=MY_SERVER_NAME
>
> #foreach remote branch, create a local branch with the same name that
> tracks it
> createLocalBranch() {
>         local BRANCHES=$*
>         for B in ${BRANCHES}; do
>                 git branch `echo $B | cut -d"/" -f2` --track $B
>         done
> }
>
> pushAllBranchesToGerrit() {
>         #get the list of remote branches without the spaces at the
> beginning
>         local BRANCHES=`git branch -r | cut -d" " -f3`
>
>         createLocalBranch ${BRANCHES}
>
>         # push all the changes to Gerrit server
>         git push --all ssh://${username}@
> ${gerrit_srv}:29418/${REPO_PROJECT}
> }
>
> pushAllBranchesToGerrit
>
> ________________________________________
>
> Then from the TOP dir of Android:
>
> repo forall -c 'FuzzyScript.sh'
>
> I rely here on the fact that repo forall brings me to the dir of each
> project.
>
> Finally I had all my branches in Gerrit.
>
> I am sending this first to have comment if I did something wrong, or
> superfluous. Second to help people that might want to do something similar.
>
> Emmanuel Grumbach
> [EMAIL PROTECTED]
>

-- 
To unsubscribe, email [EMAIL PROTECTED]
More info at http://groups.google.com/group/repo-discuss?hl=en