In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
1. Repo Profile
repo is a tool developed by Google to manage Android repositories. repo is a Python wrapper for git, not a replacement for git. It simplifies the management of multiple Git repositories. All repositories managed with repo require the git command to operate.
1.1 Introduction to manifest library files
Manifest files are organized in xml format, and a manifest library can contain multiple manifest files and multiple branches, each with a corresponding version.
remote element
A remote repository named korg is defined with a base address of git://172.16.1.31
project element
Used to define a project, the path attribute indicates the location of the clone in the workspace, and the name attribute indicates the relative path to the remote repository of the project.
default element
Set the default remote repository for each project to Korg and the default branch to gingerbread-exdroid-stable. Individual projects can also define their own remote and revision overrides to default configurations.
The child element copyfile under the project element
Define an attachment action after project clone, copy file from src to dest
1.2 Download repo code
Create a folder for your project
mkdir mstar648
Go to Project Folder
cd mstar648
Execute Code Pull Command
repo init -u ssh://ppgerrit.com/Mstar648/manifest.git-b 648_cultraview -m ppos4.5.0_cultraview.xml1.3 explore repo folder
View mstar648 directory by following command
ls -a
You can see that there is a.repo folder in the directory, indicating that the mstar648 project is a repo managed repository.
Go to.repo and view the contents of the directory
You can see that under the.repo directory there are manifest, project, repo folder and other information.
If you want to see Python wrapped scripts, go to.repo/repo and see:
If you want to see which branch a module is currently in, you can go to Manifests:
Because when we first pulled the code, it was ppos4.5.0_cultraview.xml, so open ppos4.5.0_cultraview.xml through vim, and then you can pass it through
/Module Name
View branch information to modules. For example, if we want to see the branch information of PposTv, we can search/PposTv
2. Repo Common Commands 2.1 Parsing Pulling Code Commands
For example, when we pull code, the command is as follows:
repo init -u ssh://ppgerrit.com/Mstar648/manifest.git -b 648_cultraview -m ppos4.5.0_cultraview.xml
Of which:
-u: Specify a URL that links to a manifest repository
-b: Select a special branch in the manifest repository
-m: Select an xml file in the manifest repository
Repo init does the following:
Complete download of repo tool, execute repo script just boot program
clone manifest library manifest.git (address is argument after-u)
clone's manifest library is located in manifest.git, clone goes to local.repo/manifest,. repo/manifest.xml is just a symbolic link to. repo/manifests/default.xml
If there are multiple xml files in the manifest, repo init can select any one of them. The default is default.xml.
The above example of pulling code selects the configuration in ppos4.5.0_cultraview.xml, so.repo/manifest.xml points to. repo/manifests/ppos4.5.0_cultraview.xml
2.2 synchronization code (repo sync)
After executing the repo init command, we need to execute the following command synchronization code:
repo sync
Clone and synchronize the repository by referencing the manifest file.repo/manifest.xml. If the project version library does not exist, executing repo sync is equivalent to executing git clone; if the project version library exists, it is equivalent to executing the following two instructions:
git remote update
This is equivalent to fetching each remote source
git rebase origin/branch
Performs a rebase operation on the tracing branch of the current branch
2.3 Create and switch branches (repo start)
The code just cloned is unbranched, for example:
repo start essentially encapsulates git checkout -b, creating new branches locally for a single project or all projects based on branches already set in the manifest file.
Difference between repo start and git checkout -b:
repo start creates a new branch based on the branch set in the manifest file
git checkout -b creates a new branch based on the current branch
If the branch set in the manifest file is remoteBranchName, create a new branch localBranchName.
The command to create the localBranchName branch for a single project is as follows:
repo start localBranchName project absolute path
The command to create the localBranchName branch for all projects is as follows:
repo start localBranchName --all2.4 View branches
All commands below this article are run in a single project!!!
For example, check the branch information of each module under the mstar648 project pulled above
Run the following command under the mstar648 project:
repo branches
2.5 Switch branches (repo checkout)
Switch branch syntax:
repo checkout brancnName
2.6 View differences in workspace files (repo diff)
View file differences Syntax:
repo diff 2.7 View file status (repo status)
This command is essentially a wrapper around the git diff-index and git diff-filter commands, showing both the status of the scratch pad and the status of local file modifications
View file status Syntax:
repo status
Of which:
The first line of each section shows the name of the project and the name of the branch it is in
The first letter of the second line of each section indicates the status of the scratch file modification
- No change
A: Add (not in HEAD, in staging area)
M: modify (in HEAD, in scratch pad, different content)
D: Delete (in HEAD, not in staging area)
R: rename (not in HEAD, in staging area, path modification)
C: Copy (not in HEAD, in staging area, copy from other files)
T: file status change (in HEAD, in scratch pad, same content)
U: Not merged, conflict resolution required
The second letter in the second line of each section indicates the change status of workspace files
- : new/unknown (not in staging area, in workspace)
m: modified (in staging area, in workspace, modified)
d: delete (in staging area, not in workspace 2.8 delete specified branch (repo abandon)
This command essentially encapsulates git branch -D with the following syntax:
repo abandon branchName2.9 Delete merged branches (repo prune)
This command is essentially a wrapper for git branch -d. It is used to scan the branches of the project and delete the merged branches. The syntax is as follows:
repo prune 2.10 Add files to index table (repo stage)
This command essentially encapsulates the git add --interactive command, which is used to add changes in the project workspace to the staging area. The syntax is as follows:
repo stage -i
where-i stands for--interactive, giving the user an interface to choose from
2.11 Set up repo remote
The syntax is as follows:
repo remote addd remoteName url
For example:
repo remote add org ssh://172.16.1.31/git_repo
This command is a remote branch added according to the xml file, which is convenient for submitting code to the server. After execution, the new remote branch is org under the build directory.
2.12 Traverse all git repositories under the current project (repo forall)
This command acts as an iterator that iterates through all the git repositories in the current project, executing the same shell command in all the specified projects.
The syntax is as follows:
repo forall -c command
Among them, parameters include:
-c: any shell commands that can be supported by the system (ls,cp,pwd, etc.)
-p: Lists project names before shell command output
-v: Lists error messages for executing shell command output
The command can also add environment variables:
The parameters of environment variables are as follows:
REPO_PROJECT: Specify the name of the project
REPO_PATH: Specifies the relative path of the project in the workspace
REPO_REMOTE: Specifies the name of the remote repository for the project
REPO_LREV: Specifies the hash value corresponding to the last submission of the project to the server repository
REPO_RREV: Specifies the specified branch of the project when cloned, revision attribute in manifest
If the shell command following-c is an environment variable as described above, you need to enclose the shell command in single quotes.
The syntax is as follows:
repo forall -c 'echo $REPO_PROJECT'2.13 Merge multiple branches
For example, switch all projects to the master branch.
repo forall -p -c git merge local
The above command merges the local branch into the master branch
2.14 tag
The command to label all items is as follows:
repo forall -c git tag tag name 2.15 Reveal repo version
After repo is installed, you can check the version number with the repo version command.
2.16 help documentation
After repo is installed, you can find a document summarizing all commands, and run the following command on the terminal:
repo help
If you want to see the details of a specific command, you can do the following command:
repo help command name
For example, if you want to see the specific information of the start command:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.