Android BSP,使用repo管理源代码。
共有多个不同平台,如imx6,imx5,zx2000等等。每个平台又分为不同板子。因此有多个分支。
需要基于imx6_m6_vab820
创建新的branch。
当前我的工作目录中,代码处于zx2000_l5_vt6091
branch。
使工作目录干净,就是删除未跟踪的和已跟踪但是内容改变了的文件。
repo init -b imx6_m6_vab820
repo sync
sync完之后,报错,某个项目三方合并失败。查看一些项目git状态,发现分支错乱,就是各种本地分支都指向最新commit,分支跟踪也丢了。
动作失败。
重新在新建目录All下进行。
repo init -u ... -b imx6_m6_vab820
repo sync -c
repo start --all imx6-m6-vab820
repo forall -c "git checkout -b imx6-m6-artigo_a820"
查看分支
~/workspace/01-git/mce-tfs03/Android/All$ repo branch
* imx6-m6-artigo_a820 | in all projects
imx6-m6-vab820 | in all projects
~/workspace/01-git/mce-tfs03/Android/All$ repo upload
> no branches ready for upload
~/workspace/01-git/mce-tfs03/Android/All$ repo forall -c "git push tfs imx6-m6-artigo_a820"
To http://。。。_arm64.git
* [new branch] imx6-m6-artigo_a820 -> imx6-m6-artigo_a820
Total 0 (delta 0), reused 0 (delta 0)
……
进入.repo/manifests
git checkout -b imx6-m6-artigo_a820
vim default.xml, change revision
repo sync -c
Fetching projects: 99% (455/459) Fetching project platform_external_chromium-libpac.git
Fetching projects: 100% (459/459), done.
Syncing work tree: 100% (459/459), done.
libcore/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/android-emulator/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/clang/darwin-x86/host/3.6/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/clang/linux-x86/host/3.6/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/devtools/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/eclipse/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/gcc/darwin-x86/aarch64/aarch64-linux-android-4.9/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/gcc/darwin-x86/arm/arm-eabi-4.8/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.9/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/gcc/darwin-x86/host/headers/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/gcc/darwin-x86/mips/mips64el-linux-android-4.9/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/gcc/darwin-x86/x86/x86_64-linux-android-4.9/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/gcc/linux-x86/mips/mips64el-linux-android-4.9/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/gradle-plugin/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/libs/libedit/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/maven_repo/android/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/misc/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/ndk/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/python/darwin-x86/2.7.5/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/python/linux-x86/2.7.5/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/qemu-kernel/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/sdk/: leaving imx6-m6-artigo_a820; does not track upstream
prebuilts/tools/: leaving imx6-m6-artigo_a820; does not track upstream
查看原因
~/workspace/01-git/mce-tfs03/Android/All/dalvik$ git branch -vv
* imx6-m6-artigo_a820 f8ed7d3 Fixes unnecessary multi-merge steps.
imx6-m6-vab820 f8ed7d3 [tfs/imx6-m6-vab820] Fixes unnecessary multi-merge steps.
~/workspace/01-git/mce-tfs03/Android/All/prebuilts/android-emulator$ git branch -vv
* (分离自 b728a25) b728a25 am 353d3bf8: (-s ours) Update emulator binaries to fix platform boot. automerge: 9a73dd3
imx6-m6-artigo_a820 b728a25 am 353d3bf8: (-s ours) Update emulator binaries to fix platform boot. automerge: 9a73dd3
imx6-m6-vab820 b728a25 am 353d3bf8: (-s ours) Update emulator binaries to fix platform boot. automerge: 9a73dd3
vim manifest.xml
----
"tfs"
fetch="http://..../tfs/DefaultCollection/Android/_git" />
"aosp"
fetch="git://..../vab-820/aosp"
revision="refs/tags/android-6.0.1_r3" />
"refs/heads/imx6-m6-artigo_a820"
remote="tfs"
sync-j="4" />
……
"platform_testing" name="platform_platform_testing.git" />
"prebuilts/android-emulator" name="platform/prebuilts/android-emulator" groups="pdk-fs" remote="aosp" />
"prebuilts/clang/darwin-x86/host/3.6" name="platform/prebuilts/clang/darwin-x86/host/3.6" groups="pdk,darwin" remote="aosp" />
"prebuilts/clang/linux-x86/host/3.6" name="platform/prebuilts/clang/linux-x86/host/3.6" groups="pdk,linux" remote="aosp" />
"prebuilts/devtools" name="platform/prebuilts/devtools" groups="pdk-fs" remote="aosp" />
"prebuilts/eclipse" name="platform/prebuilts/eclipse" groups="pdk" remote="aosp" />
"prebuilts/gcc/darwin-x86/aarch64/aarch64-linux-android-4.9" name="platform/prebuilts/gcc/darwin-x86/aarch64/aarch64-linux-android-4.9" groups="pdk,darwin,arm" remote="aosp" />
"prebuilts/gcc/darwin-x86/arm/arm-eabi-4.8" name="platform/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.8" groups="pdk,darwin,arm" remote="aosp" />
----
~/workspace/01-git/mce-tfs03/Android/All/prebuilts/android-emulator$ git remote -v
aosp git://.../vab-820/aosp/platform/prebuilts/android-emulator (fetch)
aosp git://.../vab-820/aosp/platform/prebuilts/android-emulator (push)
在tfs上查看git对应的branch
原来这些项目都是从另一个服务器fetch来的。
但是迷惑的地方
为什么 repo branch显示所有的projects都在分支imx6-m6-artigo_a820,而实际上某些project却是分离的分支状态。
/workspace/01-git/mce-tfs03/Android/All$ repo branch
* imx6-m6-artigo_a820 | in all projects
imx6-m6-vab820 | in all projects
~/workspace/01-git/mce-tfs03/Android/All/prebuilts/android-emulator$ git branch -vv
* (分离自 b728a25) b728a25 am 353d3bf8: (-s ours) Update emulator binaries to fix platform boot. automerge: 9a73dd3
imx6-m6-artigo_a820 b728a25 am 353d3bf8: (-s ours) Update emulator binaries to fix platform boot. automerge: 9a73dd3
imx6-m6-vab820 b728a25 am 353d3bf8: (-s ours) Update emulator binaries to fix platform boot. automerge: 9a73dd3
本地manifest文件使用
What I do in a situation like this is to create a file named local_manifest.xml in the .repo directory which contains information about the projects that will deviate from the branch I’ve already synced. For example:
<manifest>
<remove-project name="platform/bionic"/>
<project path="bionic"
name="platform/bionic"
revision="my-awesome-feature-branch"/>
manifest>
After adding this file I simply repo sync again.