如何提交Code到google open source android gerrit

        也许你在进行android开发的时候会发现一些android原生的问题,那么你可以提交issue到google issue网站上,当然在提交的时候最好能先搜一下在google issue上是否已经有相关的CR已经提交过了,那么有就可以参考一下遇到该问题的Coder们都怎么分析的,申请一个gmail帐号你也可以和大家一起讨论,那么如果你想要将自己对该问题的修改提交到android的仓库里应该怎么办呢?这就是本篇文章要讲述的主要内容:如何提交你的修改到Android gerrit上。

首先来了解两个官方网站:

1.android issue list

  url: http://code.google.com/p/android/issues/list

 

  这个网站上会有目前提交到android上的所有issue,这里你可以提交issue,管理你的issue,也可搜索已有的issue

2.android gerrit

  url:https://android-review.googlesource.com

  这个网站上会有android release上所有提交,可以查看所有提交,管理自己的提交,添加android&google的人员

  对你的提交进行review.

  


了解以上两个官方网址之后,接下来我们就做提交code的准备了,前提是你需要提交的code已经准备好,我主要是基于个人第一次提交code的经历将过程讲述一遍,如果你想要

看官方的详细说明可以看 android 官网的 Submitting Patches 这个页面的描述。

基于本地(ubuntu)有android源码滴同学,提交code到android 仓库步骤

1.将自己的code修改完毕并验证过OK

2.配置android gerrit

  1) 用gmail登录到https://android-review.googlesource.com

  2) 点击右上角用户名进入settings ---> Agreements ---> New Contributor Agreement一路操作下去各种agree就行了  (如果找不到任何的Agreement,则访问:https://cla.developers.google.com/clas  创建一个吧。)

  3) 到 establish a password 上按照说明在本地shell执行一遍就ok

3.cd 修改code所在仓库的.git目录下

  vi config

  按照如下方式添加aosp的remote信息,以5.0 frameworks/webview为例

  [remote "aosp"]
    url = https://android.googlesource.com/platform/frameworks/webview
    review = https://android-review.googlesource.com
    projectname = platform/frameworks/webview
    fetch = +refs/heads/*:refs/remotes/aosp/*

4.1) git fetch  aosp   # fetch aosp远程仓库

   2) git branch -r |grep aosp   

       fetch完成之后通过上面这条命令可以看到如下aosp相关的分支

  aosp/chromium-dev
  aosp/idea133
  aosp/idea133-weekly-release
  aosp/jb-mr2-dev
  aosp/master
  aosp/tools_r22.2  

  3) git checkout -b aosp_master  aosp/master #创建本地aosp_master分支

  4) git config user.name "XXX"  #配置提交的用户名和邮箱,这里的name和email需要

                                                      和android-review.googlesource.com上用户设置下profile中保持一致。

      git config user.email  [email protected]

  5) git add, git commit这些命令几乎是日常就不说了,注意git log看一下提交message中一定要是

      android gerrit上的用户信息(name&email),不然会提交失败,错误提示类似如下:

      remote: ERROR:  In commit 2a34a535511c4e4b6f6baf91b6eedca2fcb37a1a
      remote: ERROR:  committer email address [email protected]
      remote: ERROR:  does not match your user account.
      remote: ERROR:
      remote: ERROR:  The following addresses are currently registered:
      remote: ERROR:    [email protected]

  6) repo upload . --br aosp_master  # 提交到android gerrit 一路yes就可以了

  7) 在你所修改的模块中查找该模块owner名字,在gerrit上add他们对你的code进行review


  铛铛....到android-review.googlesource.com上查看你的提交已经上去啦~~


转摘自:https://blog.csdn.net/annaload/article/details/42524289

谢谢了

猜你喜欢

转载自blog.csdn.net/wangwei890702/article/details/80048594
今日推荐