我只需要指定版本的 Chromium 的代码,例如 r69297,它是 Chrome 的最新开发版本。我使用 git,所以我按照这里的说明操作: http ://code.google.com/p/chromium/wiki/UsingGit 但是,在我同步所有代码并查看提交日志后,我找不到这个修订版!然后我想到了标签,并在这里搜索。 如何使用 git 检出指定版本的 Webkit? 在这里我找到了,但是按照所有步骤进行操作后,等待了很长时间,我仍然一无所获。铬的git存储库是否保留标签信息?我怎样才能得到它们?谢谢
2 回答
当被问到这个问题时,Chromium 使用了 SVN。现在,git 是主要的 VC 系统,所以我将使用 git tags/hashes 而不是 r#### 修订。
在这个答案中,我假设您已经设置了构建 Chromium 的先决条件(包括初始结帐)。如果您没有那个,请按照http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html上的教程继续操作。您可以跳过该gclient sync
步骤,因为您将在以下步骤中替换依赖项。
场景:我想在最新的稳定 Chromium 版本之上应用补丁。要了解最新的稳定版本,只需访问https://omahaproxy.appspot.com/。根据该页面,最新版本是 38.0.2125.104。如果您想查看以前/下一个版本,请访问http://blink.lc/chromium/refs/了解标签的概述。此标签列表包括未发布的版本,例如 38.0.2125.106(当在由第三个数字标识的基线之上应用新补丁时,最后一个内部版本号会增加)。
# Inside chromium/src/
git fetch origin 38.0.2125.106
# Create a new branch "my_stable_branch" that is based on the just-fetched HEAD.
git checkout -b my_stable_branch FETCH_HEAD
# ... apply the patch ...
# (e.g. by editing the files)
# (e.g. by using git cherry-pick [commit id] )
# (e.g. by using git checkout [commit id] [file path] )
# Commit changes (assuming that you want to keep track of your changes)
git commit -va
# Now synchronize the dependencies to the current branch
gclient sync --with_branch_heads # --jobs 16 if you wish to use parallelism
# Now compile the release build. The output will be stored in src/out/Release.
ninja -C out/Release chrome chrome_sandbox
分支机构
如果您找不到特定的提交,我会检查它是否在“master”以外的分支中。当您第一次克隆存储库时,您只会获得“主”分支。您可以运行以下命令来签出远程 Chromium 存储库中可用的分支:
git branch new-local-branch origin/some-remote-branch
git checkout new-local-branch
显然,为远程分支使用正确的名称,并将本地分支命名为合乎逻辑的名称。
标签
当你克隆一个 Git 存储库时,你应该默认获取它的所有标签。git tag
您可以通过运行或获取所有已定义标签的列表git tag -l
。
如果您没有看到任何标签,请尝试显式获取它们:
git fetch --tags
获得所需的标签后,检查它以开始使用该版本的代码库:
git checkout <name of tag>