开发者

What is Repo and Why does Google use it?

开发者 https://www.devze.com 2022-12-22 20:25 出处:网络
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 t开发者_运维技巧hat enables me to

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 t开发者_运维技巧hat enables me to pause/resume syncing, because every time I get disconnected occasionally it seems that repo starts syncing from the beginning!


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.


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.


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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消