Download multiple branches to the same directory using repo

1

repo is a python script that manages cyanogenmod source code download.

to download cm-10.1 branch, repo command is,

cd ~/cm-10.1

repo init -u https://github.com/CyanogenMod/android.git -b cm-10.1

cd ~/cm-11

then we can use --reference option to download cm-11 source code like

repo init --reference=~/cm-10.1 -u https://github.com/CyanogenMod/android.git -b cm-11.0

but, that downloads the delta data into cm-11 directory.

I want to download all the cyanogenmod branches in single directory and build as required. How can i do this?

d6cbe4

Posted 2015-03-03T17:48:31.137

Reputation: 11

The branches need to stay separate. That's why they're separated into different branches in the first place: that way files can be changed without affecting the files in other branches. Why are you trying to download them all into the same directory? – hololeap – 2015-03-05T22:10:19.270

to download the 2nd branch i use --reference option which is path sensitive. And to download further branches, multiple references cannot be set which means i have to download lot more data which i might already have in different branches.. – d6cbe4 – 2015-03-07T04:51:03.347

Answers

0

Since you are using the same URL for all the branches, you can download them to a single folder, and still they are kept separate.

You can download multiple branches of project files into a single .repo folder in a single working directory. This saves disk space and eliminates hurdles like path sensitive repo --reference , inability to use multiple references.

To download all branches into same .repo folder, do

repo init -u https://github.com/CyanogenMod/android.git -b cm-10.1
repo sync
repo init -b cm-10.2
repo sync
repo init -b cm-11.0
repo sync

and the list goes..
This downloads all the branches to the single .repo folder in a single working directory. When initializing a second branch, we donot provide the -u url option because we are reusing a different branch from local repo.

After repo sync the working directory contains the last initialized branch and this is completely harmless. We are only concerned about the working directory, not the contents of .repo folder. The branches still stay separate.

You may occasionally use repo forall -c git gc to pack all loose objects into pack files.

Bharat G

Posted 2015-03-03T17:48:31.137

Reputation: 524