如何从git获取Chromium指定标签版本的代码?

时间:2010-12-19 05:49:06

标签: git chromium

我只需要像r69297那样的指定版本的Chromium代码,这是Chrome的最新开发版本。 我使用git所以我按照这里的说明: http://code.google.com/p/chromium/wiki/UsingGit 但是,在我同步所有代码并查看提交日志后,我找不到此修订版! 然后我想到了标签,并在这里搜索。 How to use git to checkout a specified version of Webkit? 在这里,我发现,但在遵循所有步骤,并等待相当长的时间后,我仍然一无所获。 铬的git存储库是否保留标签信息?我怎么能得到它们? THX

2 个答案:

答案 0 :(得分:15)

当问到这个问题时,Chromium使用了SVN。如今,git是主要的VC系统,所以我将使用git标签/哈希而不是r #### revisions。

在这个答案中,我假设您已经设置了构建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

答案 1 :(得分:1)

<强>分支机构

如果找不到特定的提交,我会检查它是否在“master”以外的分支中。首次克隆存储库时,只能获得“主”分支。您可以运行以下命令来检出远程Chromium存储库上可用的分支:

git branch new-local-branch origin/some-remote-branch
git checkout new-local-branch

显然,使用远程分支的正确名称,并将本地分支命名为逻辑。

<强>代码

当你克隆一个Git repo时,你应该默认获得它的所有标签。您可以通过运行git taggit tag -l来获取所有已定义标记的列表。

如果您没有看到任何标记,请尝试明确提取它们:

git fetch --tags

获得所需的标记后,请检查它以开始使用该版本的代码库:

git checkout <name of tag>

相关问题