repo init 和 repo sync 实际上是做什么的? [英] What does repo init and repo sync actually do?

查看:67
本文介绍了repo init 和 repo sync 实际上是做什么的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Android Enthusiasts 上发布了这个问题,但我认为问这个问题的地方不对,所以我从那里删除了它并在这里再次"提问.

<小时>

这是一个菜鸟问题,如果是,请原谅我,但我只是想清楚地理解基本概念.阅读 repo 帮助和 Google 的 repo 命令参考页面并没有真正启发多少.我从 Google 的参考页面中了解了一些内容,但我仍然需要更多说明.

按照关于如何下载android源代码的说明,我在Ubuntu shell上执行了这两个命令:(我已经考虑了环境的所有先决条件.)

~/android4.2.2$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.2.2_r1.2~/android4.2.2$ repo sync -j4

等了半天repo下载完成,结果在android4.2.2目录下下载了19G的素材.那么到底发生了什么,为什么当 Google 说我应该只期待大约 8G 的源文件时它达到了 19G?

解决方案

repogit 的 Python 包装脚本,其 Google 源 page 将其定义为

<块引用>

repo - 多 Git 存储库工具

  1. repo init 命令初始化当前目录中的 repo.也就是说,它下载最新的 repo 源和一个描述 git 存储库目录结构的 manifest.xml 文件,并将所有这些存储在 .repo 子目录中当前目录.在您的情况下,您使用了一个可选的 -b 参数,用于选择要结帐的分支.默认情况下(即,当不使用 -b 参数时),使用 master 分支.

  2. repo sync 将工作树更新到最新版本.也就是说,它将本地项目目录与清单文件中指定的远程存储库同步.如果一个本地项目尚不存在,它将从远程存储库克隆一个新的本地目录,并按照清单中的指定设置跟踪分支.如果本地项目已经存在,它将更新远程分支并将任何新的本地更改重新绑定到新的远程更改之上.-j 参数用于设置要执行的并行作业数.默认值可以在清单中定义,也可以在命令行中像你的情况一样被覆盖.

<块引用>

为什么当 Google 说我应该只期待大约 8G 的源文件时它达到了 19G?

那应该是因为除了源文件之外,你会得到Android从一开始的所有历史:)

希望这会有所帮助.

I posted this question at Android Enthusiasts but figured it was the wrong place to ask, so I deleted it from there and asking it "again" here.


This is such a noob question, and pardon me if it is, but I just want to understand the underlying concepts clearly. Reading repo help and Google's repo command reference page doesn't really enlighten much. I understood some bits from Google's reference page, but I still need some more clarifications.

Following the instructions on how to download android source, I executed these two commands on an Ubuntu shell: (I've taken cared of all the prerequisites for the environment.)

~/android4.2.2$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.2.2_r1.2
~/android4.2.2$ repo sync -j4

After waiting half a day for repo to finish downloading, I ended up with 19G of downloaded material in android4.2.2 directory. So what exactly just happened, and why did it reach 19G when Google said I should only be expecting around 8G of source files?

解决方案

repo is a python wrapper script for git, its Google Source page defines it as

repo - The Multiple Git Repository Tool

  1. repo init command initializes repo in the current directory. That's, it downloads the latest repo source and a manifest.xml file that describes the directory structure of the git repositories, and store all of these in .repo sub-directory in the current directory. In your case, you have used an optional -b argument which is used to select the branch to checkout. By default (i.e., when -b argument is not used), master branch is used.

  2. repo sync updates working tree to the latest revision. That's, it synchronizes local project directories with the remote repositories specified in the manifest file. If a local project does not yet exist, it will clone a new local directory from the remote repository and set up tracking branches as specified in the manifest. If the local project already exists, it will update the remote branches and rebase any new local changes on top of the new remote changes. -j argument is used to set number of parallel jobs to execute. The default value can be defined in the manifest, and also can be overridden in command line as in your case.

why did it reach 19G when Google said I should only be expecting around 8G of source files?

That should be because besides the source files, you will get all the history of Android since the beginning of the time :)

Hope this helps.

这篇关于repo init 和 repo sync 实际上是做什么的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆