0%

使用 repo manfiest 管理项目代码

使用 repo 管理工程代码,需要切换不同仓库和不同分支,记录如下

需要在原有 repo 中增加其他工程指定分支代码

  1. 下载指定 repo manfiest,指定分支

    git clone ssh://git@ip/to/manifests.git
    cd manifests
    git checkout origin/$SOURCE $SOURCE
  2. default.xml 如下

    <manifest>
     <remote  name="aosp"
             fetch="https://android.googlesource.com/"/>
    
     <default revision="master"
             remote="aosp"
             sync-j="4" />
    
     <project path="art" name="platform/art" />
     <project path="bionic" name="platform/bionic" groups="pdk" />
     <project path="tools/adt/eclipse" name="platform/tools/adt/eclipse" groups="notdefault,tools" />
    </manifest>
  3. 编辑 default.xml,增加另一个仓库指定分支代码, remote 指定仓库, revision 指定分支或 tag

    <manifest>
     <remote  name="aosp"
             fetch="https://android.googlesource.com/"/>
     <remote  name="udinic"
             fetch="https://github.com/udinic/"/>
    
     <default revision="master"
             remote="aosp"
             sync-j="4" />
    
     <project path="art" name="platform/art" />
     <project path="bionic" name="platform/bionic" groups="pdk" />
     <project path="dalvik" name="platform_dalvik” remote=“udinic”/>
     <project path="frameworks/base" name="platform_frameworks_base" remote=“udinic" revision=“statusbar_fixes"/>
     <project path="tools/adt/eclipse" name="platform/tools/adt/eclipse" groups="notdefault,tools" />
    </manifest>
  4. 上传 default.xml 到指定分支 $SOURCE

    git add default.xml
    git commit -m "add some projects"
    git push
  5. repack 对松散对象进行打包

    ssh git@ip -t /home/git/repac