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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4481803/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 04:51:22  来源:igfitidea点击:

how to get code of specified tag version of Chromium from git?

gitchromium

提问by ayanamist

i just need code of specified version of Chromium like r69297 which is the latest dev version of Chrome. i use git so i follow the instruction here: http://code.google.com/p/chromium/wiki/UsingGithowever, after i sync all the code, and review the commit log, i can't find this revision! then i thought about tag, and searched here. How to use git to checkout a specified version of Webkit?here i found, but after follow all the steps, and wait for quite a long long time, i still get nothing. does the git repository of chromium keep the tag information? how can i get them? thx

我只需要指定版本的 Chromium 代码,例如 r69297,它是 Chrome 的最新开发版本。我使用 git,所以我按照这里的说明操作:http: //code.google.com/p/chromium/wiki/UsingGit但是,在我同步所有代码并查看提交日志后,我找不到此修订版!然后我想到了标签,并在这里搜索。 如何使用 git 检出指定版本的 Webkit?我在这里找到了,但是在按照所有步骤进行操作并等待很长时间之后,我仍然什么也没有。铬的git存储库是否保留标签信息?我怎样才能得到它们?谢谢

回答by Rob W

When the question was asked, Chromium used SVN. Nowadays, git is the primary VC system, so I will use git tags/hashes instead of r#### revisions.

当被问到这个问题时,Chromium 使用了 SVN。现在,git 是主要的 VC 系统,所以我将使用 git 标签/哈希而不是 r#### 修订版。

In this answer, I assume that you have already set up the pre-requisites for building Chromium (including an initial checkout). If you don't have that one, follow the tutorial at http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.htmlbefore continuing. You can skip the gclient syncstep because you'll replace the dependencies anyway in the steps below.

在这个答案中,我假设您已经设置了构建 Chromium 的先决条件(包括初始结帐)。如果您没有那个,请在继续之前按照http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html 上的教程进行操作。您可以跳过该gclient sync步骤,因为您将在以下步骤中替换依赖项。

Scenario: I want to apply a patch on top of the latest stable Chromium version. To find out the latest stable build, just visit https://omahaproxy.appspot.com/. According to that page, the latest version is 38.0.2125.104. If you want to see previous/next releases, visit http://blink.lc/chromium/refs/for an overview of tags. This list of tags includes unreleased versions, e.g. 38.0.2125.106 (the last build number increases when new patches are applied on top of the baseline that is identifier by the third number).

场景:我想在最新的稳定 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

回答by semperos

Branches

分行

If you can't find a particular commit, I'd check if it's in a branch other than "master". When you first clone a repository, you only get the "master" branch. You can run the following to checkout a branch available on the remote Chromium repository:

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

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

Obviously use the correct name for the remote branch and name your local branch something logical.

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

Tags

标签

When you clone a Git repo, you should get all of its tags by default. You can get a list of all defined tags by running git tagor git tag -l.

当您克隆 Git 存储库时,默认情况下您应该获取其所有标签。您可以通过运行git tag或来获取所有已定义标签的列表git tag -l

If you don't see any tags, try fetching them explicitly:

如果您没有看到任何标签,请尝试显式获取它们:

git fetch --tags

git fetch --tags

Once you have the tag you want, check it out to start using that version of the code base:

一旦你有了你想要的标签,检查它以开始使用该版本的代码库:

git checkout <name of tag>

git checkout <name of tag>