ImageVerifierCode 换一换
你正在下载:

repo-git.ppt

[预览]
格式:PPT , 页数:24 ,大小:336.50KB ,
资源ID:7367932      下载积分:10 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.docduoduo.com/d-7367932.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(repo-git.ppt)为本站会员(myw993772)主动上传,道客多多仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知道客多多(发送邮件至docduoduo@163.com或直接QQ联系客服),我们立即给予删除!

repo-git.ppt

1、Android source code management,An introduction to Git, Repo, and Gerrit for Android developers.,Toolchain overview,Our Android source code is managed very differently from the OSE phones. Weve fully embraced the Google toolchain, which means a whole new set of tools to work with.,ClearCase,Git,CME,R

2、epo,DeliveryWeb,Gerrit,Version control,Repository mgmt,Delivery,Code review,Android 是谷歌(Google)开发的适合手持设备的操作系统,提供了当前最吸引眼球的开源的手持设备操作平台,大有超越苹果(A)专有的 iOS 系统的趋势。而 Android 的源代码就是使用 Git 进行维护的。Android 项目在使用 Git 进行源代码管理上有两个伟大的创造,一个 是用 Java 开发的名为 Gerrit 的代码审核服务器,另外一个就是本章要重点介绍的repo。,Introducing Repo,Repo is a

3、Google-developed tool for managing multiple Git repositories and submitting code for review to the Gerrit code review system. The Android platform source code consists of hundreds of repositories. Repo keeps track of the available repositories and helps us perform tasks on all of these usually with

4、one single command. Like CME, Repo wraps but does not replace the underlying version control system. In your daily work youll use both Git and Repo. The collection of git repositories is recorded in a manifest file. The manifest file is an XML file with a list of repositories and corresponding branc

5、hes, revisions, or tags. It is quite similar to the Modules section of a 1551 file.,The most common Repo commands,$ repo sync Downloads the latest changes in all repositories, rebasing your own branches as necessary. $ repo start Create a new branch for working on a topic. $ repo upload Upload one o

6、f more changes to the Gerrit code review system.,Introducing Gerrit,Gerrit is a Google-developed tool thats used by their Android open source project (AOSP). It is purely web based and relies on Git for storing the source code. Each Git commit becomes a change when uploaded to Gerrit. A change is su

7、bject to review and verification by one or more parties. The uploader of a change can at any time update the change. When the change is verified and approved, the uploader will submit the change to the designated branch. After the change has been submitted, it is no longer possible to update it. Ger

8、rit automatically tracks dependencies between changes in the same git.,Integrated change,The life of a source code change,Git,Hack hack hack,git commit,repo upload,Reviewable,Code reviewed,Verified,Code reviewed & verified,Git,Submit,Developer 1,Developer 2,Git,repo sync,Change,Change,Why Gerrit,Ger

9、rit is not only used by Google internally, it is used to maintain the OSS part of Android.Puts an extra, protective layer around the integration branch.With Gerrit, everyone can be a contributor, regardless of team affiliation.We dont want to let anyone check in anything at anytime, thats why we hav

10、e a review step.So, having clean commits helps the reviewer, and thus also yourself, in addition to making life easier in maintenance.,Basic workflow with repo and Gerrit,repo init u git:/ b ohd-cupcake-deckard repo sync cd myproject repo start mytopic057 # editeditedit git status git add git status

11、 git commit repo sync; repo uploadNow Gerrit takes over and you start over on a new branch $ repo start newtopic058 .,Repo init,repo init u -b Running repo init will download the manifest and repo repositories. Where repo can find the manifest repository is handled with the -u option. If a manifest

12、branch is specified with the -b option, this branch of the manifest git will be checked out. If no branch is specified, the master branch of the manifest will be used.Example:repo init -u git:/ b ohd-cupcake-deckard,Repo sync,repo sync .repo sync will iterate through the specified or all repositorie

13、s listed in the manifest and download the latest changes.After all changes are downloaded, your topic branch will be rebased on top of the latest version of the branch listed in the manifest for that repository.Normally, this version will be the latest approved version on the parent (release/integra

14、tion) branch.Only non-delivered topic branches will be rebased with repo sync.Never manually resolve any upload conflicts with git merge!,Repo start,repo start -all | .repo start creates a new branch starting from the revision (of the corresponding project) that is listed in the manifest.When using

15、Gerrit, this means that the branch will always be based on the latest approved software without any dependencies to changes that have not passed review.,Repo upload,repo upload . | -replace repo upload will push your changes to Gerrit for review. All commits not already delivered will be uploaded. E

16、ach commit will be a new change.If you have amended your commit, you can replace the change set for a Gerrit change by using the -replace option.,Repo download,repo download project /Downloads and checks out the specified change from GerritThis commit can be amended and uploaded again using repo upl

17、oad -replace,Repo abandon,repo abandon If you realize that what you were working on should be scrapped, you can abandon this topic. repo abandon only affects your local repository.You can also abandon a change in Gerrit. This will only affect that change in Gerrit and not affect any Git repository.,

18、Repo prune,repo prune . When you have uploaded your topics and they have been merged by Gerrit, you can run repo prune. repo prune will delete topic branches that are already merged to the integration branch. Only topic branches that have been merged to the integration branch will be deleted this is

19、 a safe command to run.,Repo forall,repo forall . -c .Runs a loop which will execute on every git repository.This is handy when there is no corresponding repo command for what you want to do.,Gerrit doesnt merge my commit,Your commit was approved and you submitted the change, but Gerrit still says “

20、Review in progress”Check the change comments. If Gerrit had problems merging the commit, it will be listed here.If a merge conflict was the problem, make sure you have the latest changes synced to your workspace. Checkout your topic branch with the change in question on it and rebase it against the

21、parent branch. The you can replace the old commit.,$ repo sync $ git checkout my-old-topic $ git rebase m/sw-integration $ git mergetool $ git rebase -continue $ repo upload -replace .,I forgot repo startwheres my commit?,If you forget to run repo start to create a topic branch, you will by default

22、work on a “detached head”. I.e. any commits you make after that will float around headless. You can recover. Run git reflog and find the commit you made. Start a new topic branch Then cherry-pick the commit using the first characters from the hash key as listed in the reflog and you are back on trac

23、k.,$ git reflog d230d0e. HEAD0: commit: Removed Camera/Album app. Its in the Camera apk. . $ repo start new-topic . $ git cherry-pick d230d0e,Changeset abuse Scenario One,You made a really cool change and committed it. Unfortunately, that last “harmless” edit you made turned out to break everythingI

24、f you worked on a topic branch, you have only harmed yourselfYou edit the file so that it works again and commit the fix.Now you want to share your nice new and working feature with othersYou upload your topic branch to Gerrit. Repo will upload ALL your commits on the topic branch including the brok

25、en oneSomeone discovers the error in the first commit during review. What happens?,Multiple commits in one change,Multiple commits multiple changes to review in Gerrit Which commit should be approved? How does the reviewer know what happened? If the broken commit is rejected, the second, containing

26、the fix, can never be merged as it depends on the rejected one.,Integration branch,Two commits,Upload,Two changes,Amending commits,If you discover that your previous commit was incomplete or broken you canAmend it!Check out the relevant topic branch Make your fix Add the changes to the index with gi

27、t add Now create a new commit, where you “fuse” your changes in the index with the previous commit:git commit -amendPresto changeo! You have a new commit with the fix in it, that replaces your previous one.,More than one “bad” commit?,Amending a commit only works with the previous one. If your funct

28、ionality are spread over more commits, you must use other means to put it in one single commitLuckily, this can be done, as you will see shortly,Checkpoint commits,You might commit when You go for lunch Try out some “experimental” code Try different solutions to the same problem Or many other reason

29、sThis is all fine butIf uploaded, each commit will be registered as a separate change in GerritBefore you share your changesmerge or “squash” related changesremove unrelated changes so that you only get a “clean” historyThen the integration branch will look nice and you will help the reviewer Or, you can temporarily put your changes in the stash ,

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报