什么是 Repo 以及 Google 为什么使用它?
当我想获取Android源代码时,我知道我必须使用“repo”。那么什么是回购协议呢?为什么他们使用 repo 而不仅仅是使用 GIT?并且是否有一个用于 repo 的 GUI 使我能够暂停/恢复同步,因为每次我偶尔断开连接时,repo 似乎从头开始同步!
When I wanted to get Android source code, I knew that I have to use "repo". So what is repo? Why do they use repo and not just use GIT?, and is there a GUI for repo that enables me to pause/resume syncing, because every time I get disconnected occasionally it seems that repo starts syncing from the beginning!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
正如 android 网页中提到的,
repo
不会取代git
。它只是 git 上的一个工具,可以帮助您管理多个 git 存储库。例如,假设我有一个具有很多功能的大项目,并且我有多个团队致力于每个功能,并且我为每个功能创建了一个存储库。例如,假设我的存储库是
wifi
、telephony
、power management
等。当您的功能具有不同的生命周期时,此操作有意义。例如,如果我不会在下一个版本中触及wifi
功能,但我会修改其余所有功能。所以在这种场景下,我的项目或者产品分布在几个不同的git仓库中。因此,为了获得我的项目的集中照片(我的项目的一个特定时刻,例如里程碑),我需要获取每个存储库的修订(git 哈希或标签)。请记住,我们为每个功能都有一个存储库。我可以手动完成,但可能会非常痛苦。因此,通过 repo,您可以拥有一个 MANIFEST,它链接到每个 git repo 的所有修订版(每个功能一个),并拥有我的整个项目的具体图片。
简而言之,我可以说这是一种管理集中式多个分散的 git 存储库的方法。
使用 repo,您可以拥有更多功能,而不仅仅是在特定点结账。有关更多信息,请访问 http://source.android.com/source/using-repo .html。
As is mentioned in the android webpage,
repo
does not replacegit
. It is just a tool overgit
and helps you to manage multiple git repositories.For example, suppose I have a big project which has a lot of features and I have several teams working on each feature and I created one repository for each feature. For example suppose my repositories are
wifi
,telephony
,power management
, etc. This action has sense when your features have different life cycles. For example if I won't touch thewifi
feature in my next release and but I will modify all the rest. So under this scenario, my project or product is distributed in several different git repositories.So, to get a centralized photo of my project (one specific moment of my project, for example a milestone), I need to get the revision (git hash or tag) of each repository. Remember that we have one repository for each feature. Manually I could do it but could be very painful. So, with repo you can have one
MANIFEST
which links to all the revisions of each git repo (one for each feature) and have a specific picture of my whole project.Simply, I could say that is a way to manage centralized multiple git repositories which are decentralized.
With repo you have more features, not only to checkout at a specific point. For more info go to http://source.android.com/source/using-repo.html.
Repo 和 git - 它们是什么,它们的用途 - 在 source.android.com 上进行了解释
据我所知,Repo 没有 GUI,但上面的网站上有很多指导,用于控制 Repo 从命令行执行的操作。
Repo and git - what they are, what they are for - is explained on source.android.com
There's no GUI for Repo, as far as I can tell, but there's quite a bit of guidance on the site above for controlling what Repo is doing from the command line.
关于暂停和重新启动点,在终端窗口中进行存储库同步时,您可以点击“ctrl + z”来暂停存储库同步。要重新启动,只需在同一窗口中输入“fg”即可。
Concerning the pause and restart point, whilst in a terminal window doing a repo sync you can hit, "ctrl + z" to pause the repo sync. To restart simply type "fg" into the same window.
转到:
http://source.android.com/source/git-repo.html
,您可以下载
repo
脚本。它是一个 Python 脚本,使用 git 命令进行分布式源代码修订。执行
reposync
后,执行ps -auwf
来查看进程:对于我的我看到:
是的,
repo 同步
经常中断。但它很强大,只需重新启动命令,它就会再次恢复同步 - 那些已更新的内容将不会重新应用,因此它将跳过它们并继续其余部分。Go to:
http://source.android.com/source/git-repo.html
and you can download the
repo
script. It is a Python script that uses thegit
command to do distributed source code revision.After you have executed
repo sync
, do aps -auwf
to see the processes:For mine I saw:
Yes,
repo sync
breaks often. But it is robust, just restart the command and it will resuming syncing again - those that have been updated will not be re-applied, so it will skip over them and continue with the rest.repo 同步有各种有用的选项:
-f 从断开连接中恢复
-c 仅上传您要求的分支
-j <#CPUS>通过增加命令使用的 cpu 数量来加速同步
repo sync has various useful options:
-f recovers from disconnects
-c just uploads the branch you asked for
-j <#CPUS> speeds up the sync by increasing the number of cpus used by the command