android 仓库下载分析

众所周知,google android使用repo+git管理源码,并封装repo来管理多个git仓库。从source.android.com上下载源码都要先下载repo脚本,

        $ curl http://android.git.kernel.org/repo >~/bin/repo
      $ chmod a+x ~/bin/repo
      $ export PATH=$PATH:~/bin

        再使用

        repo init -u git://android.git.kernel.org/platform/manifest.git  -b master 

      来下载repo 仓库和manifest 清单文件仓库。

      manifest仓库,主要是一些xml文件,说明要从哪个服务器去取哪一个git仓哪一个revision分支,下载到本地保存到哪个路径。

      因此,通过manifest仓库,repo就能方便地管理多个git仓库。

      repo init 完成后,在本地会生成.repo文件夹,其中包含manifest.git ,manifest,repo等文件夹和default.xml文件,其中default.xml是到manifest中文件的一个链接。

      repo sync 执行会读取manifest中仓库,项目,版本信息,然后下载代码到本地。同时在repo下会下载一个projects文件夹,里面包含所有工程的本地仓库。

      工作目录下所有含有.git文件夹的目录,都是一个git仓库,同时它们的配置信息都通过链接指向了projets文件夹对应项目.git。

       

        repo start  branchname  --all   等价于  repo forall -c "git checkout -b branchname  remotes/origin/branchname"

        repo status 查看工作目录和index,index和Head commit间的区别。

        repo upload 提交代码到gerrit 服务器审批。

      


   

你可能感兴趣的:(android)