• Gerrit清单库配置(转载)


    From:http://fatalove.iteye.com/blog/1340334

    gerrit清单库是用来配合repo使用的。清单库中列出了gerrit服务器上的其他版本库。

    客户端通过repo脚本下载清单库后,脚本会解析清单库中列出的库并自动下载。

    首先执行repo init,下载版本库,然后执行repo sync下载所有库的代码。

    首先将repo版本库克隆至本地并push到gerrit服务器。

    git clone https://android.googlesource.com/tools/repo

    创建一个空的清单库manifest.git,清单库中只有xml文件。

    在清单库中创建default.xml文件,将manifest.git通过push传至gerrit服务器。

    这是服务器就多了两个库:repo.git和manifest.git

    default.xml内容:

    <?xml version="1.0" encoding="UTF-8"?>  
    <manifest>  
      <remote fetch="ssh://gerrituser@192.168.222.149:29418" name="remote_name1" review="192.168.222.1:8081"/>  
      
      <default remote="remote_name1" revision="master" />  
      
      <project name="test" path="android/packages" >  
        <copyfile dest="a_in_root.txt" src="a_in_test.txt"/>  
      </project>  
      
    </manifest>

    project标签的name属性值test为gerrit服务器中对应的的仓库名称;

    project标签的path属性值表示客户端迁出代码是使用的根目录名称;

    copyfile表示在代码下载下来之后将test仓库的src指定的文件复制到dest路径下。

    default标签中的revision值为gerrit服务器上的分之名称或者commitid。

    配置完成后,使用repo下载代码。

    $ mkdir code
    $ cd code
    $ repo init -u ssh://admin@ip:29418/manifest.git -m default.xml --repo-url=ssh://user@ip:29418/tools/repo.git --repo-branch=master --no-repo-verify
    $ repo sync
    $ ls

    通过ls可以查看到一个android/packages目录。

    repo sync之后

    [root@server44-137 ]# git branch 
    * (no branch)

    本地没有分支,可以执行git branch -r 查看有哪些远程分支,然后执行git checkout --track 远程分支名

    [root@server44-137 ]# git branch -r
       remote-branch1
    [root@server44-137 ]# git checkout --track remote-branch1
    Branch remote-branch1set up to track remote branch remote-branch1from github.
    Switched to a new branch 'remote-branch1'
  • 相关阅读:
    第1章习题
    生成树相关问题
    cf 710 E Generate a String
    树状数组(BIT)
    HDU 5360 Hiking(2015多校联合)
    Apache HttpClient4.0&HtmlCleaner用法
    Android中的长度单位详解(dp、sp、px、in、pt、mm)
    HDU 5328 Problem Killer(2015多校联合)
    HDU 5327 Olympiad(2015多校联合)
    HDU 5335 Walk Out(2015多校联合)
  • 原文地址:https://www.cnblogs.com/xiaoerlang/p/3578705.html
Copyright © 2020-2023  润新知