What is Repo and Why does Google use it?

2020-05-15 13:00发布

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!

标签: android git repo
5条回答
Luminary・发光体
2楼-- · 2020-05-15 13:03

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.

查看更多
SAY GOODBYE
3楼-- · 2020-05-15 13:10

Go to:

http://source.android.com/source/git-repo.html

and you can download the repo script. It is a Python script that uses the git command to do distributed source code revision.

After you have executed repo sync, do a ps -auwf to see the processes:

For mine I saw:

\_ python -E /sde3/root/download/android/android/.repo/repo/main.py --rep 
      \_ git fetch korg
            \_ git fetch korg
            \_ git index-pack --stdin -v --fix-thin --keep=fetch-pack 5227 on

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.

查看更多
等我变得足够好
4楼-- · 2020-05-15 13:13

As is mentioned in the android webpage, repo does not replace git. It is just a tool over git 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 the wifi 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 an 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.

查看更多
戒情不戒烟
5楼-- · 2020-05-15 13:14

Repo and git - what they are, what they are for - is explained on source.android.com

To work with the Android code, you will need to use both Git and Repo.

Git is an open-source version-control system designed to handle very large projects that are distributed over multiple repositories. In the context of Android, we use Git for local operations such as local branching, commits, diffs, and edits.

Repo is a tool that we built on top of Git. Repo helps us manage the many Git repositories, does the uploads to our revision control system, and automates parts of the Android development workflow. Repo is not meant to replace Git, only to make it easier to work with Git in the context of Android. The repo command is an executable Python script that you can put anywhere in your path.

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.

查看更多
对你真心纯属浪费
6楼-- · 2020-05-15 13:22

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

查看更多
登录 后发表回答