Commit 5b1f4aaf authored by Oleh Prypin's avatar Oleh Prypin Committed by Commit Bot

Revert "Reland "bot_update: Pass target-ref to gclient.""

This reverts commit 867e3c95.

Reason for revert: Fails to apply patch onto a branch head.
Example failure: https://ci.chromium.org/p/webrtc/builders/try/linux_compile_rel/13395
vs previous successful run: https://ci.chromium.org/p/webrtc/builders/try/linux_compile_rel/13307

Original change's description:
> Reland "bot_update: Pass target-ref to gclient."
>
> This is a reland of f61af569
>
> gclient was updated to handle these refs on
> https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1590495
>
> Original change's description:
> > bot_update: Pass target-ref to gclient.
> >
> > Bug: 956807
> > Recipe-Nontrivial-Roll: infra
> > Recipe-Nontrivial-Roll: skia
> > Recipe-Nontrivial-Roll: build_limited_scripts_slave
> > Recipe-Nontrivial-Roll: build
> > Change-Id: I4d786d989446b8c1e3f39ef78c3c99cfe70808c0
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1588502
> > Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> > Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
>
> Bug: 956807
> Recipe-Nontrivial-Roll: infra
> Recipe-Nontrivial-Roll: build_limited_scripts_slave
> Recipe-Nontrivial-Roll: build
> Change-Id: I06b2b517d3f1aeb0a12b7c5fc58f1621533dae5c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1592214
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>

TBR=nodir@chromium.org,tandrii@chromium.org,ehmaldonado@chromium.org

Bug: 956807, webrtc:10406
Recipe-Nontrivial-Roll: infra
Recipe-Nontrivial-Roll: skia
Recipe-Nontrivial-Roll: build_limited_scripts_slave
Recipe-Nontrivial-Roll: build
Change-Id: I6db0802e1951c3241d0a3c080bea51423582cb3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1593052
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: 's avatarOleh Prypin <oprypin@chromium.org>
Auto-Submit: Oleh Prypin <oprypin@chromium.org>
parent 9c062012
...@@ -143,12 +143,8 @@ class BotUpdateApi(recipe_api.RecipeApi): ...@@ -143,12 +143,8 @@ class BotUpdateApi(recipe_api.RecipeApi):
if patch: if patch:
repo_url = self.m.tryserver.gerrit_change_repo_url repo_url = self.m.tryserver.gerrit_change_repo_url
fetch_ref = self.m.tryserver.gerrit_change_fetch_ref fetch_ref = self.m.tryserver.gerrit_change_fetch_ref
target_ref = self.m.tryserver.gerrit_change_target_ref
if repo_url and fetch_ref: if repo_url and fetch_ref:
flags.append([ flags.append(['--patch_ref', '%s@%s' % (repo_url, fetch_ref)])
'--patch_ref',
'%s@%s:%s' % (repo_url, target_ref, fetch_ref),
])
if patch_refs: if patch_refs:
flags.extend( flags.extend(
['--patch_ref', patch_ref] ['--patch_ref', patch_ref]
...@@ -199,8 +195,8 @@ class BotUpdateApi(recipe_api.RecipeApi): ...@@ -199,8 +195,8 @@ class BotUpdateApi(recipe_api.RecipeApi):
if fixed_revision: if fixed_revision:
fixed_revisions[name] = fixed_revision fixed_revisions[name] = fixed_revision
if fixed_revision.upper() == 'HEAD': if fixed_revision.upper() == 'HEAD':
# Sync to correct destination ref if HEAD was specified. # Sync to correct destination branch if HEAD was specified.
fixed_revision = self._destination_ref(cfg, name) fixed_revision = self._destination_branch(cfg, name)
# If we're syncing to a ref, we want to make sure it exists before # If we're syncing to a ref, we want to make sure it exists before
# trying to check it out. # trying to check it out.
if (fixed_revision.startswith('refs/') and if (fixed_revision.startswith('refs/') and
...@@ -372,13 +368,13 @@ class BotUpdateApi(recipe_api.RecipeApi): ...@@ -372,13 +368,13 @@ class BotUpdateApi(recipe_api.RecipeApi):
return step_result return step_result
def _destination_ref(self, cfg, path): def _destination_branch(self, cfg, path):
"""Returns the ref branch of a CL for the matching project if available or """Returns the destination branch of a CL for the matching project
HEAD otherwise. if available or HEAD otherwise.
If there's no Gerrit CL associated with the run, returns 'HEAD'. If there's no Gerrit CL associated with the run, returns 'HEAD'.
Otherwise this queries Gerrit for the correct destination ref, which Otherwise this queries Gerrit for the correct destination branch, which
might differ from refs/heads/master. might differ from master.
Args: Args:
cfg: The used gclient config. cfg: The used gclient config.
...@@ -386,13 +382,11 @@ class BotUpdateApi(recipe_api.RecipeApi): ...@@ -386,13 +382,11 @@ class BotUpdateApi(recipe_api.RecipeApi):
'src/v8'. The query will only be made for the project that matches 'src/v8'. The query will only be made for the project that matches
the CL's project. the CL's project.
Returns: Returns:
A destination ref as understood by bot_update.py if available A destination branch as understood by bot_update.py if available
and if different from refs/heads/master, returns 'HEAD' otherwise. and if different from master, returns 'HEAD' otherwise.
""" """
# Ignore project paths other than the one belonging to the current CL. # Ignore project paths other than the one belonging to the current CL.
patch_path = self.m.gclient.get_gerrit_patch_root(gclient_config=cfg) patch_path = self.m.gclient.get_gerrit_patch_root(gclient_config=cfg)
if patch_path:
patch_path = patch_path.replace(self.m.path.sep, '/')
if not patch_path or path != patch_path: if not patch_path or path != patch_path:
return 'HEAD' return 'HEAD'
...@@ -400,7 +394,13 @@ class BotUpdateApi(recipe_api.RecipeApi): ...@@ -400,7 +394,13 @@ class BotUpdateApi(recipe_api.RecipeApi):
if target_ref == 'refs/heads/master': if target_ref == 'refs/heads/master':
return 'HEAD' return 'HEAD'
return target_ref # TODO: Remove. Return ref, not branch.
ret = target_ref
prefix = 'refs/heads/'
if ret.startswith(prefix):
ret = ret[len(prefix):]
return ret
def _resolve_fixed_revisions(self, bot_update_json): def _resolve_fixed_revisions(self, bot_update_json):
"""Set all fixed revisions from the first sync to their respective """Set all fixed revisions from the first sync to their respective
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
"--output_json", "--output_json",
"/path/to/tmp/json", "/path/to/tmp/json",
"--patch_ref", "--patch_ref",
"https://chromium.googlesource.com/chromium/src@refs/heads/master:refs/changes/56/123456/7", "https://chromium.googlesource.com/chromium/src@refs/changes/56/123456/7",
"--revision", "--revision",
"src@HEAD", "src@HEAD",
"--disable-syntax-validation" "--disable-syntax-validation"
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
"--output_json", "--output_json",
"/path/to/tmp/json", "/path/to/tmp/json",
"--patch_ref", "--patch_ref",
"https://chromium.googlesource.com/angle/angle@refs/heads/master:refs/changes/56/123456/7", "https://chromium.googlesource.com/angle/angle@refs/changes/56/123456/7",
"--revision", "--revision",
"src@HEAD", "src@HEAD",
"--revision", "--revision",
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
"--output_json", "--output_json",
"/path/to/tmp/json", "/path/to/tmp/json",
"--patch_ref", "--patch_ref",
"https://chromium.googlesource.com/chromium/src@refs/heads/master:refs/changes/56/123456/7", "https://chromium.googlesource.com/chromium/src@refs/changes/56/123456/7",
"--revision", "--revision",
"src@HEAD", "src@HEAD",
"--disable-syntax-validation" "--disable-syntax-validation"
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
"--output_json", "--output_json",
"/path/to/tmp/json", "/path/to/tmp/json",
"--patch_ref", "--patch_ref",
"https://chromium.googlesource.com/chromium/src@refs/heads/master:refs/changes/56/123456/7", "https://chromium.googlesource.com/chromium/src@refs/changes/56/123456/7",
"--revision", "--revision",
"src@HEAD", "src@HEAD",
"--disable-syntax-validation" "--disable-syntax-validation"
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
"--output_json", "--output_json",
"/path/to/tmp/json", "/path/to/tmp/json",
"--patch_ref", "--patch_ref",
"https://chromium.googlesource.com/chromium/src@refs/heads/master:refs/changes/56/123456/7", "https://chromium.googlesource.com/chromium/src@refs/changes/56/123456/7",
"--revision", "--revision",
"src@HEAD", "src@HEAD",
"--disable-syntax-validation" "--disable-syntax-validation"
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
"--output_json", "--output_json",
"/path/to/tmp/json", "/path/to/tmp/json",
"--patch_ref", "--patch_ref",
"https://chromium.googlesource.com/angle/angle@refs/heads/master:refs/changes/56/123456/7", "https://chromium.googlesource.com/angle/angle@refs/changes/56/123456/7",
"--revision", "--revision",
"src@HEAD", "src@HEAD",
"--revision", "--revision",
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
"--output_json", "--output_json",
"/path/to/tmp/json", "/path/to/tmp/json",
"--patch_ref", "--patch_ref",
"https://chromium.googlesource.com/chromium/src@refs/branch-heads/67:refs/changes/56/123456/7", "https://chromium.googlesource.com/chromium/src@refs/changes/56/123456/7",
"--revision", "--revision",
"src@refs/branch-heads/67", "src@refs/branch-heads/67",
"--refs", "--refs",
......
...@@ -56,11 +56,9 @@ ...@@ -56,11 +56,9 @@
"--output_json", "--output_json",
"/path/to/tmp/json", "/path/to/tmp/json",
"--patch_ref", "--patch_ref",
"https://chromium.googlesource.com/chromium/src@refs/heads/experimental/feature:refs/changes/56/123456/7", "https://chromium.googlesource.com/chromium/src@refs/changes/56/123456/7",
"--revision", "--revision",
"src@refs/heads/experimental/feature", "src@experimental/feature",
"--refs",
"refs/heads/experimental/feature",
"--disable-syntax-validation" "--disable-syntax-validation"
], ],
"env_prefixes": { "env_prefixes": {
......
...@@ -56,11 +56,11 @@ ...@@ -56,11 +56,11 @@
"--output_json", "--output_json",
"/path/to/tmp/json", "/path/to/tmp/json",
"--patch_ref", "--patch_ref",
"https://chromium.googlesource.com/v8/v8@refs/heads/experimental/feature:refs/changes/56/123456/7", "https://chromium.googlesource.com/v8/v8@refs/changes/56/123456/7",
"--revision", "--revision",
"src@HEAD", "src@HEAD",
"--revision", "--revision",
"src/v8@refs/heads/experimental/feature", "src/v8@experimental/feature",
"--disable-syntax-validation" "--disable-syntax-validation"
], ],
"env_prefixes": { "env_prefixes": {
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
"--output_json", "--output_json",
"/path/to/tmp/json", "/path/to/tmp/json",
"--patch_ref", "--patch_ref",
"https://webrtc.googlesource.com/src@refs/heads/master:refs/changes/56/123456/7", "https://webrtc.googlesource.com/src@refs/changes/56/123456/7",
"--revision", "--revision",
"src@HEAD", "src@HEAD",
"--revision", "--revision",
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
"--output_json", "--output_json",
"/path/to/tmp/json", "/path/to/tmp/json",
"--patch_ref", "--patch_ref",
"https://chromium.googlesource.com/v8/v8@refs/heads/master:refs/changes/56/123456/7", "https://chromium.googlesource.com/v8/v8@refs/changes/56/123456/7",
"--revision", "--revision",
"src@HEAD", "src@HEAD",
"--revision", "--revision",
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
"--output_json", "--output_json",
"/path/to/tmp/json", "/path/to/tmp/json",
"--patch_ref", "--patch_ref",
"https://chromium.googlesource.com/v8/v8@refs/heads/master:refs/changes/56/123456/7", "https://chromium.googlesource.com/v8/v8@refs/changes/56/123456/7",
"--revision", "--revision",
"src@HEAD", "src@HEAD",
"--revision", "--revision",
......
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