I have downloaded whole working tree with the following command:
repo init -u https://android.googlesource.com/platform/manifest
repo sync -j8
After syncing successfully, I want to switch working tree to android 2.3.7.
You see I didn’t specify branch with “-b” parameter when “repo init”.
So I guess all tag info should be downloaded and I can easily switch to android 2.3.7 with the following command:
repo forall -c git checkout android-2.3.7_r1
But it produces many errors like:
error: pathspec 'android-2.3.7_r1' did not match any file(s) known to git.
So how can I switch to android 2.3.7 without “repo init -b android-2.3.7_r1” and “repo sync” again?
You cannot solve this problem using
repo forall.Lets assume for certainty that your current Android tree is clean – no local changes or commits, i.e.
repo statusshows nothing.To properly switch Android version, all you need to change is branch for your manifest repository. First determine the available branches with manifests for the different Android versions:
Select a version and
Such selective
repo initwith-b(without-u) will only update manifest branch and will not otherwise touch your tree.Now, simply sync it:
and some time later, your Android tree will switch to another version.
Speed of this operation is mostly determined by how much
default.xmlmanifest file differs between old and new Android versions – because if some git repository was added in new manifest, it will spend time cloning it. And if some repository was removed, if will actually blow it away.But, by and large, this method is still much faster than initializing brand new Android tree from scratch.