Anreoid repo 切换分支

查看可切换的分支
cd .repo/manifests
git branch -a | cut -d / -f 3


以 gingerbread-release 分支为例
repo init -b android-4.1.2_r1


repo sync (not needed if your local copy is up to date)
repo start android-4.1.2_r1 --all 
查看当前的分支
repo branches
正在尝试这一种看看可不可以,执行repo sync后//我的好像还更新了
error: bionic/: platform/bionic checkout f57514eb59747171f55cd9b4abb064f1a474d5ee
error: external/valgrind/: platform/external/valgrind checkout d5d3abcc16492e823e09201a56a7d8c991e194d9
error: prebuilt/: platform/prebuilt checkout 4046d154f6b6d0722a7c1199e4be9322531cb3ca
wv@LiXia_PC ~/Android-4.0.0_r1
$ ~/bin/repo branches
*  android-4.1.2_r1          | not in bionic, external/valgrind, prebuilt
报错了,没有全部转完!
***********************************************************

查看当前所有分支:git branch -a

把所有的库切换分支:  repo forall  -c git checkout branch_name

删除所有库的某个分支: repo forall  -c git branch -D branch_name
 
$ ~/bin/repo sync -j1
remote: Counting objects: 597, done
remote: Finding sources: 100% (4/4)
remote: Total 4 (delta 2), reused 4 (delta 2)
Unpacking objects: 100% (4/4), done.
From https://android.googlesource.com/platform/build
   923ac1a..a1fd8e4  master     -> aosp/master
Fetching projects: 100% (293/293), done.
info: A new version of repo is available


object 45d21685b93f80b67239849b2d2cfe6b217e335a
type commit
tag v1.12.2
tagger Shawn Pearce <[email protected]> 1362159402 -0800

repo 1.12.2

error: cannot run gpg: No such file or directory
error: could not run gpg.
error: could not verify the tag 'v1.12.2'


warning: Skipped upgrade to unverified version
Syncing work tree:   0% (2/293)  error: Your local changes to the following files would be overwritten by checkout:
        libc/kernel/common/linux/netfilter/xt_CONNMARK.h
        libc/kernel/common/linux/netfilter/xt_MARK.h
        libc/kernel/common/linux/netfilter_ipv6/ip6t_HL.h
Please, commit your changes or stash them before you can switch branches.
Aborting
Syncing work tree:  55% (162/293)  error: Your local changes to the following files would be overwritten by checkout:
        main/docs/html/FAQ.html
Please, commit your changes or stash them before you can switch branches.
Aborting
Syncing work tree:  90% (264/293)  error: Your local changes to the following files would be overwritten by checkout:
        linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr/include/linux/netfilter/xt_CONNMARK.h
        linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr/include/linux/netfilter/xt_DSCP.h
        linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr/include/linux/netfilter/xt_MARK.h
        linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr/include/linux/netfilter/xt_TCPMSS.h
        linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr/include/linux/netfilter_ipv4/ipt_CONNMARK.h
        linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr/include/linux/netfilter_ipv4/ipt_DSCP.h
        linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr/include/linux/netfilter_ipv4/ipt_ECN.h
        linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr/include/linux/netfilter_ipv4/ipt_MARK.h
        linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr/include/linux/netfilter_ipv4/ipt_TCPMSS.h
        linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr/include/linux/netfilter_ipv4/ipt_TOS.h
        linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr/include/linux/netfilter_ipv4/ipt_TTL.h
        linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr/include/linux/netfilter_ipv6/ip6t_HL.h
        linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/sysroot/usr/include/linux/netfilter_ipv6/ip6t_MARK.h
Please, commit your changes or stash them before you can switch branches.
Aborting
Syncing work tree: 100% (293/293), done.

error: bionic/: platform/bionic checkout f57514eb59747171f55cd9b4abb064f1a474d5ee
error: external/valgrind/: platform/external/valgrind checkout d5d3abcc16492e823e09201a56a7d8c991e194d9
error: prebuilt/: platform/prebuilt checkout 4046d154f6b6d0722a7c1199e4be9322531cb3ca
 好像没有成功更新

wv@wv-ThinkPad-SL:~/android/source$ repo sync
Fetching projects: 100% (293/293), done. 
fatal: bad config file line 1 in .git/config
Traceback (most recent call last):
  File "/home/wv/android/source/.repo/repo/main.py", line 414, in <module>
    _Main(sys.argv[1:])
  File "/home/wv/android/source/.repo/repo/main.py", line 390, in _Main
    result = repo._Run(argv) or 0
  File "/home/wv/android/source/.repo/repo/main.py", line 138, in _Run
    result = cmd.Execute(copts, cargs)
  File "/home/wv/android/source/.repo/repo/subcmds/sync.py", line 630, in Execute
    project.Sync_LocalHalf(syncbuf)
  File "/home/wv/android/source/.repo/repo/project.py", line 1086, in Sync_LocalHalf
    lost = self._revlist(not_rev(revid), HEAD)
  File "/home/wv/android/source/.repo/repo/project.py", line 2006, in _revlist
    return self.work_git.rev_list(*a, **kw)
  File "/home/wv/android/source/.repo/repo/project.py", line 2155, in rev_list
    p.stderr))
error.GitError: platform/bionic rev-list ('^f57514eb59747171f55cd9b4abb064f1a474d5ee', 'HEAD', '--'): fatal: bad config file line 1 in .git/config

wv@wv-ThinkPad-SL:~/android/source$
  上面问题终于可以解决了,不用删除.repo, .repo已经8G了,怎么舍得删了重新同步呢?
再新建一个目录android4.3,执行 repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2(这个源根据个人意愿不同而不同)
再把原来那个目录下的.repo覆盖到新建的android4.3目录下,再进行repo sync就OK了。
原来的目录可以删了
所有源码单独下载:https://android.googlesource.com/tools/repo/
软件共享:
http://pan.baidu.com/share/link?shareid=317254&uk=2299385808
 
 
 
另外,听说已经更新android 4.1源再执行repo init不会再重新下载所有源码
如果已经有android仓库但是还不是最新的,想切换到AndroidL分支分支
(1).cd .repo/manfiests && git branch -a | cut -d / -f 3
android-4.4.4_r2.0.1
android-4.4_r1
android-4.4_r1.0.1
android-4.4_r1.1
android-4.4_r1.1.0.1
android-4.4_r1.2
android-4.4_r1.2.0.1
android-4.4w_r1
android-5.0.0_r1
android-5.0.0_r2
(2).根据上面列表的选取android-5.0.0_r2 
repo init -b android-5.0.0_r2
(3). repo sync
(4).全部切换到android-5.0.0_r2分支
repo start android-5.0.0_r2 --all
(5). repo branches
*  android-5.0.0_r2          | in all projects
(6).cd external/jsmn && git branch
* android-5.0.0_r2

猜你喜欢

转载自wv1124.iteye.com/blog/1838217
今日推荐