从google 代码仓库repo sync Android4.0 源代码

本文详细介绍如何使用Repo工具下载Android项目的完整源代码树。包括安装配置Repo、初始化客户端、指定分支检出以及同步代码等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

下载源代码树:

首先,安装Repo

按照如下步骤安装,初始化,配置Repo

  • 新建立一个bin目录,并加到环境变量:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
  • 下载Repo脚本和修改权限为可执行:
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
  • Repo的校验和(这里不懂什么意思,有知道的不?)
The SHA-1 checksum for repo is e1fd3bef059d152edf4d0522590725d317bc637f

其次,初始化一个Repo 客户端
  • 新建一个空文件夹,这个文件夹名字任意取
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
  • 运行repo init 更新manifest到你的工作目录,也就是上面建立的目录?
$ repo init -u https://android.googlesource.com/platform/manifest
检出一个分支而不是主干,指定 -b:
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
  • 到这里有个提示,需要输入真实姓名和email,如果想要用Gerrit code-review tool,就需要一个google账号,并确保这个账号能正常收发信息。同时你提供的名字将会显示在代码提交原因里。
如果按照成功,在你的目录下将有.repo的东西。

最后,运行下面命令,获取代码文件
$ repo sync
这里就漫长的等待。。。直到同步完毕。
info: Restarting repo with latest version
Fetching projects: 100% (221/221), done.  
Checking out files: 100% (13480/13480), done. files:  10% (1368/13480)   
Checking out files: 100% (4556/4556), done.ut files:  11% (539/4556)   
Checking out files: 100% (9385/9385), done.out files:  32% (3013/9385)   
Checking out files: 100% (4582/4582), done.out files:   9% (456/4582)   
Checking out files: 100% (4876/4876), done.out files:  11% (577/4876)   
Checking out files: 100% (8657/8657), done.out files:   4% (367/8657)   
Checking out files: 100% (644/644), done.ng out files:  22% (147/644)   
Checking out files: 100% (1421/1421), done. out files:  34% (487/1421)   
Checking out files: 100% (3156/3156), done.
Checking out files: 100% (24598/24598), done.ut files:  40% (9873/24598)   
Checking out files: 100% (18692/18692), done.ut files:   0% (10/18692)   
Checking out files: 100% (23382/23382), done.ut files:   0% (18/23382)   
Checking out files: 100% (2868/2868), done. out files:  49% (1417/2868)   
Syncing work tree: 100% (221/221), done.  



To make edits to changes after they have been uploaded, you should use a tool like git rebase -i or git commit --amend to update your local commits. After your edits are complete: Make sure the updated branch is the currently checked out branch. For each commit in the series, enter the Gerrit change ID inside the brackets: # Replacing from branch foo [ 3021 ] 35f2596c Refactor part of GetUploadableBranches to lookup one specific... [ 2829 ] ec18b4ba Update proto client to support patch set replacments # Insert change numbers in the brackets to add a new patch set. # To create a new change record, leave the brackets empty. After the upload is complete the changes will have an additional Patch Set. If you only want to upload the currently checked out Git branch, you can use the flag --current-branch (or --cbr for short). diff repo diff [<PROJECT_LIST>] Shows outstanding changes between commit and working tree using git diff. download repo download <TARGET> <CHANGE> Downloads the specified change from the review system and makes it available in your project's local working directory. For example, to download change 23823 into your platform/build directory: repo download platform/build 23823 A repo sync should effectively remove any commits retrieved via repo download. Or, you can check out the remote branch; e.g., git checkout m/master. Note: There is a slight mirroring lag between when a change is visible on the web in Gerrit and when repo download will be able to find it for all users, because of replication delays to all servers worldwide. forall repo forall [<PROJECT_LIST>] -c <COMMAND> Executes the given shell command in each project. The following additional environment variables are made available by repo forall: REPO_PROJECT is set to the unique name of the project. REPO_PATH is the path relative to the root of the client. REPO_REMOTE is the name of the remote system from the manifest. REPO_LREV is the name of the revision from the manifest, translated to a local tracking branch. Used if you need to pass the manifest revision to a locally executed git command. REPO_RREV is the name of the revision from the manifest, exactly as written in the manifest. Options: -c: command and arguments to execute. The command is evaluated through /bin/sh and any arguments after it are passed through as shell positional parameters. -p: show project headers before output of the specified command. This is achieved by binding pipes to the command's stdin, stdout, and sterr streams, and piping all output into a continuous stream that is displayed in a single pager session. -v: show messages the command writes to stderr. prune repo prune [<PROJECT_LIST>] Prunes (deletes) topics that are already merged. start repo start <BRANCH_NAME> [<PROJECT_LIST>] Begins a new branch for development, starting from the revision specified in the manifest. The <BRANCH_NAME> argument should provide a short description of the change you are trying to make to the projects.If you don't know, consider using the name default. The <PROJECT_LIST> specifies which projects will participate in this topic branch. Note: "." is a useful shorthand for the project in the current working directory. status repo status [<PROJECT_LIST>] Compares the working tree to the staging area (index) and the most recent commit on this branch (HEAD) in each project specified. Displays a summary line for each file where there is a difference between these three states. To see the status for only the current branch, run repo status. The status information will be listed by project. For each file in the project, a two-letter code is used: In the first column, an uppercase letter indicates how the staging area differs from the last committed state. letter meaning description - no change same in HEAD and index A added not in HEAD, in index M modified in HEAD, modified in index D deleted in HEAD, not in index R renamed not in HEAD, path changed in index C copied not in HEAD, copied from another in index T mode changed same content in HEAD and index, mode changed U unmerged conflict between HEAD and index; resolution required In the second column, a lowercase letter indicates how the working directory differs from the index. letter meaning description - new/unknown not in index, in work tree m modified in index, in work tree, modified d deleted in index, not in work tree Was this page helpful? Let us know how we did:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值