Repo usage and understanding

Source: Internet
Author: User
Tags git commands

 

Repo usage (zz)

 

 

Note: repo is only a script written by Google using Python scripts to call git. It is mainly used to download and manage the software repository of Android projects. (That is, it is used to manage the warehouses managed by GIT)

Download repo address: http://android.git.kernel.org/repo, you can download repo with either of the following

Wget http://android.git.kernel.org/repo

Or

Curl http://android.git.kernel.org/repo> ~ /Bin/Repo

After downloading, you must modify the repo permission: chmod A + x ~ /Bin/Repo

 

When you use repo sync to capture the android source code, some errors often occur, causing the repo sync to be interrupted. You must start manually each time. You can use the following command to automatically repeat

$? = 1;

While [$? -Ne 0];

Do repo sync;

Done

 

Get help:

Repo help [command] // displays the Detailed Help information of the command.

Example: repo help init to obtain other repo init usage

 

Repo init-u URL is used to install repository in the current directory. A directory ". Repo"-u will be created in the current directory to specify a URL and obtain the repository manifest file from this URL.

Example: repo init-u git: // android.git.kernel.org/platform/manifest.git

Put the obtained manifest file in the. Repo directory. Name it manifest. xml. The content of this file is actually a list Of all repositories managed by git!

 

You can use the-M parameter to obtain a specific manifest file in the repository. If it is not specified, it is represented as the default namifest file (default. XML)

Repo init-u git: // android.git.kernel.org/platform/manifest.git-M dalvik-plus.xml

(There are many manifest files available for us to choose from. All manifest files are stored in the directory. repo/manifests, and the Directory itself is also managed by git. You can go to the CD to see it)

 

You can use the-B parameter to specify a manifest branch.

Repo init-u git: // android.git.kernel.org/platform/manifest.git-B release-1.0

You will find that. repo/manifests is a git-managed repository where all manifest files (*. XML), because it is managed by git, although there are branches,-B can switch to the desired branch and then download the relevant XML file. Of course, the specific XML file to be downloaded depends on the-M parameter, therefore, if you only specify-B but not-M, download the default value under the specified branch of-B. XML file

If the-B parameter is not specified, the master branch is used by default.

 

4. Repo sync [project-list]

Download the latest local working file. The update is successful. The local file is the same as the code in repository. You can specify the project to be updated. If no parameter is specified, all projects are synchronized.

If you run repo sync for the first time, this command is equivalent to git clone, and all the content in repository will be copied to the local device. If you do not run repo sync for the first time, it is equivalent to git remote update; git rebase origin/branch. Repo sync updates the files under. repo. If a conflict occurs during the merge process, you need to manually run git rebase -- continue

 

5. Repo update [project-list]

Upload the modified Code. If your local code has been modified, you will be prompted to upload the modified Code when running repo sync, all the modified Code branches will be uploaded to Gerrit (web-based code review system). The uploaded code of Gerrit will be converted to one by one, so that people can review the modified Code.

 

6. Repo diff [project-list]

Displays the differences between the submitted code and the current working directory code.

 

7. Repo download target Revision

Download a specific version to a local device, for example, Repo download pltform/frameworks/base 1241 download the Code with the modified version 1241

 

8. Repo start newbranchname.

Create a new branch. "." Indicates the branch of the current job.

 

9. Repo prune [project list]

Delete a merge Project

 

10. Repo foreach [project-lists]-C command

Run the command for each project

 

12. Repo forall-C

This command traverses all git repositories and executes the commands specified by-C in each repository (the executed commands are not limited to just git commands, but any commands supported by the system, such as LS, PWD, and CP)

When I want to use this command to traverse all the repositories and execute "Git checkout." In each repository to clear changes to each repository, I enter the following command:

Repo forall-C git checkout.

I find that this is not the case. It seems that the repo cannot traverse and execute the checkout command. Today I finally came up with another command "Git reset -- hard head" Haha

Repo forall-C git reset -- hard head

Another new discovery: When I used to execute some commands with Repo forall, it may be a problem to traverse a warehouse, but I did not know which warehouse it was! It has never been solved. Today I finally found .... The key point is to look at the help manual provided by the command itself...

Repo help forall Use this command to view the help for forall. It is clear that the-p parameter can be added during repo execution to print the current PWD when traversing each warehouse, and then continue to execute the command specified by-C. Example:

Repo forall-p-C git Branch

 

// This command traverses all the warehouses and prints the branches of each warehouse. With the-p parameter, the path of each warehouse is printed !!!

 

11. Repo status

Displays the status of each repository in the project and prints the repository name.

 

201111071237 update

Yasin. Lee. x

-------------------------------------------------------
CPP @ CPP :~ $ Repo
Traceback (most recent call last ):
File "/home/CPP/bin/repo", line 91, in?
Import Readline
Importerror: No module named Readline
CPP @ CPP :~ $
-------------------------------------------------------
Readline exists in the system, but the repo script cannot be imported. Later, it was found that it was an error caused by Python installation. You should add the Readline compilation option during Python compilation, install python as follows
First install the Readline software package:
Sudo apt-Get install libreadline5-dev
Sudo apt-Get install zlib1g-dev
Download the Python source code to go to The Python source code directory and compile and install Python:
1. Make distclean
2../configure -- enable-Readline basecflags =-u_fortify_source
3. Make-J4
4. sudo make install
Note: I also found that python-2.4.3 supports this compilation option, but this -- enable-Readline compilation parameter cannot be identified in version 3.1.3. So I currently use version 2.4.3.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.