Commit 90c88f09 authored by Garrett Beaty's avatar Garrett Beaty Committed by Commit Bot

Reland "Fetch the input commit ref when both ref and id are specified."

This is a reland of 72a245e4

The "git checkout master --detach" operation has been modified to run in the solution
directory.

Original change's description:
> Fetch the input commit ref when both ref and id are specified.
>
> This causes --refs refs/head/master to be added to bot_update calls when
> the input build message contains a commit id and the refs/head/master
> ref. This is an effective no-op.
>
> When bot_update clones a git repository, it results in HEAD referring to
> master in contrast to the non-clone case which results in a detached
> HEAD. This prevents fetching refs/heads/master, so detach the HEAD after
> cloning.
>
> Bug: 922150
> Change-Id: I357a78305020218e9f5d350832a706b8f2b27967
> Recipe-Nontrivial-Roll: build
> Recipe-Nontrivial-Roll: build_limited_scripts_slave
> Recipe-Nontrivial-Roll: infra
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1900735
> Commit-Queue: Garrett Beaty <gbeaty@chromium.org>
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>

Bug: 922150
Change-Id: I7dc6ebed2dcbd880ff4d515f7e9fc6428ff24099
Recipe-Nontrivial-Roll: build
Recipe-Nontrivial-Roll: build_limited_scripts_slave
Recipe-Nontrivial-Roll: infra
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1910260Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Garrett Beaty <gbeaty@chromium.org>
parent 336e51f6
...@@ -56,7 +56,7 @@ Recipe module to ensure a checkout is consistent on a bot. ...@@ -56,7 +56,7 @@ Recipe module to ensure a checkout is consistent on a bot.
Wrapper for easy calling of bot_update. Wrapper for easy calling of bot_update.
&mdash; **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#498)(self, bot_update_step):** &mdash; **def [deapply\_patch](/recipes/recipe_modules/bot_update/api.py#500)(self, bot_update_step):**
Deapplies a patch, taking care of DEPS and solution revisions properly. Deapplies a patch, taking care of DEPS and solution revisions properly.
...@@ -87,7 +87,7 @@ Args: ...@@ -87,7 +87,7 @@ Args:
step_test_data: a null function that returns test bot_update.py output. step_test_data: a null function that returns test bot_update.py output.
Use test_api.output_json to generate test data. Use test_api.output_json to generate test data.
&mdash; **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#475)(self, project_name, gclient_config=None):** &mdash; **def [get\_project\_revision\_properties](/recipes/recipe_modules/bot_update/api.py#477)(self, project_name, gclient_config=None):**
Returns all property names used for storing the checked-out revision of Returns all property names used for storing the checked-out revision of
a given project. a given project.
...@@ -105,7 +105,7 @@ Returns (list of str): All properties that'll hold the checked-out revision ...@@ -105,7 +105,7 @@ Returns (list of str): All properties that'll hold the checked-out revision
&emsp; **@property**<br>&mdash; **def [last\_returned\_properties](/recipes/recipe_modules/bot_update/api.py#36)(self):** &emsp; **@property**<br>&mdash; **def [last\_returned\_properties](/recipes/recipe_modules/bot_update/api.py#36)(self):**
&mdash; **def [resolve\_fixed\_revision](/recipes/recipe_modules/bot_update/api.py#425)(self, bot_update_json, name):** &mdash; **def [resolve\_fixed\_revision](/recipes/recipe_modules/bot_update/api.py#427)(self, bot_update_json, name):**
Set a fixed revision for a single dependency using project revision Set a fixed revision for a single dependency using project revision
properties. properties.
......
...@@ -190,6 +190,8 @@ class BotUpdateApi(recipe_api.RecipeApi): ...@@ -190,6 +190,8 @@ class BotUpdateApi(recipe_api.RecipeApi):
# e.g. they want to force refs/heads/master at the config level. # e.g. they want to force refs/heads/master at the config level.
main_repo_path = self._get_commit_repo_path(in_commit, cfg) main_repo_path = self._get_commit_repo_path(in_commit, cfg)
revisions[main_repo_path] = revisions.get(main_repo_path) or in_commit_rev revisions[main_repo_path] = revisions.get(main_repo_path) or in_commit_rev
if in_commit.id and in_commit.ref:
refs = [in_commit.ref] + refs
# Guarantee that first solution has a revision. # Guarantee that first solution has a revision.
# TODO(machenbach): We should explicitly pass HEAD for ALL solutions # TODO(machenbach): We should explicitly pass HEAD for ALL solutions
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
"/path/to/tmp/json", "/path/to/tmp/json",
"--revision", "--revision",
"src@2d72510e447ab60a9728aeea2362d8be2cbd7789", "src@2d72510e447ab60a9728aeea2362d8be2cbd7789",
"--refs",
"refs/heads/master",
"--disable-syntax-validation" "--disable-syntax-validation"
], ],
"env_suffixes": { "env_suffixes": {
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
"/path/to/tmp/json", "/path/to/tmp/json",
"--revision", "--revision",
"src@2d72510e447ab60a9728aeea2362d8be2cbd7789", "src@2d72510e447ab60a9728aeea2362d8be2cbd7789",
"--refs",
"refs/heads/master",
"--disable-syntax-validation" "--disable-syntax-validation"
], ],
"env_suffixes": { "env_suffixes": {
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
"/path/to/tmp/json", "/path/to/tmp/json",
"--revision", "--revision",
"src@2d72510e447ab60a9728aeea2362d8be2cbd7789", "src@2d72510e447ab60a9728aeea2362d8be2cbd7789",
"--refs",
"refs/heads/master",
"--with_branch_heads", "--with_branch_heads",
"--disable-syntax-validation" "--disable-syntax-validation"
], ],
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
"got_revision@src", "got_revision@src",
"--revision", "--revision",
"src@HEAD", "src@HEAD",
"--refs",
"refs/heads/master",
"--disable-syntax-validation" "--disable-syntax-validation"
], ],
"env_suffixes": { "env_suffixes": {
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
"got_revision@src", "got_revision@src",
"--revision", "--revision",
"src@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "src@aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"--refs",
"refs/heads/master",
"--disable-syntax-validation" "--disable-syntax-validation"
], ],
"env_suffixes": { "env_suffixes": {
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
"/path/to/tmp/json", "/path/to/tmp/json",
"--revision", "--revision",
"src@2d72510e447ab60a9728aeea2362d8be2cbd7789", "src@2d72510e447ab60a9728aeea2362d8be2cbd7789",
"--refs",
"refs/heads/master",
"--disable-syntax-validation" "--disable-syntax-validation"
], ],
"env_suffixes": { "env_suffixes": {
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
"/path/to/tmp/json", "/path/to/tmp/json",
"--revision", "--revision",
"src@2d72510e447ab60a9728aeea2362d8be2cbd7789", "src@2d72510e447ab60a9728aeea2362d8be2cbd7789",
"--refs",
"refs/heads/master",
"--disable-syntax-validation" "--disable-syntax-validation"
], ],
"env_suffixes": { "env_suffixes": {
......
...@@ -724,6 +724,8 @@ def _git_checkout(sln, sln_dir, revisions, refs, no_fetch_tags, git_cache_dir, ...@@ -724,6 +724,8 @@ def _git_checkout(sln, sln_dir, revisions, refs, no_fetch_tags, git_cache_dir,
if not path.isdir(sln_dir): if not path.isdir(sln_dir):
git('clone', '--no-checkout', '--local', '--shared', mirror_dir, git('clone', '--no-checkout', '--local', '--shared', mirror_dir,
sln_dir) sln_dir)
# Detach HEAD to be consistent with the non-clone case
git('checkout', 'master', '--detach', cwd=sln_dir)
_git_disable_gc(sln_dir) _git_disable_gc(sln_dir)
else: else:
_git_disable_gc(sln_dir) _git_disable_gc(sln_dir)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment