Commit 53e28ecb authored by Nodir Turakulov's avatar Nodir Turakulov Committed by Commit Bot

[gclient] Remove calculate_patch_root

It is not used. get_gerrit_patch_root is used instead.

Bug: 694348
Change-Id: Icc717e38cbcaa8050c8ce8a364202b81d7f9cf2c
Reviewed-on: https://chromium-review.googlesource.com/1231282
Auto-Submit: Nodir Turakulov <nodir@chromium.org>
Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Nodir Turakulov <nodir@chromium.org>
parent 07b5283a
......@@ -247,27 +247,6 @@ Wrapper for easy calling of gclient steps.
Remove all index.lock files. If a previous run of git crashed, bot was
reset, etc... we might end up with leftover index.lock files.
&mdash; **def [calculate\_patch\_root](/recipes/recipe_modules/gclient/api.py#362)(self, patch_project, gclient_config=None, patch_repo=None):**
Returns path where a patch should be applied to based patch_project.
TODO(nodir): delete this function in favor of get_repo_path.
Maps the patch's repo to a path of directories relative to checkout's root,
which describe where to place the patch. If no mapping is found for the
repo url, falls back to trying to find a mapping for the old-style
"patch_project".
For now, considers only first solution (c.solutions[0]), but in theory can
be extended to all of them.
See patch_projects and repo_path_map solution config property.
Returns:
Relative path, including solution's root.
If patch_project is not given or not recognized, it'll be just first
solution root.
&mdash; **def [checkout](/recipes/recipe_modules/gclient/api.py#230)(self, gclient_config=None, revert=RevertOnTryserver, inject_parent_got_revision=True, extra_sync_flags=None, \*\*kwargs):**
Return a step generator function for gclient checkouts.
......@@ -328,7 +307,7 @@ Chromium config. This may happen for one of two reasons:
&mdash; **def [runhooks](/recipes/recipe_modules/gclient/api.py#264)(self, args=None, name='runhooks', \*\*kwargs):**
&mdash; **def [set\_patch\_repo\_revision](/recipes/recipe_modules/gclient/api.py#399)(self, gclient_config=None):**
&mdash; **def [set\_patch\_repo\_revision](/recipes/recipe_modules/gclient/api.py#362)(self, gclient_config=None):**
Updates config revision corresponding to patch_project.
......@@ -813,7 +792,7 @@ Returns list of paths to files affected by the patch.
Argument:
patch_root: path relative to api.path['root'], usually obtained from
api.gclient.calculate_patch_root(patch_project)
api.gclient.get_gerrit_patch_root().
Returned paths will be relative to to patch_root.
......
......@@ -359,43 +359,6 @@ class GclientApi(recipe_api.RecipeApi):
return None
def calculate_patch_root(self, patch_project, gclient_config=None,
patch_repo=None): # pragma: no cover
"""Returns path where a patch should be applied to based patch_project.
TODO(nodir): delete this function in favor of get_repo_path.
Maps the patch's repo to a path of directories relative to checkout's root,
which describe where to place the patch. If no mapping is found for the
repo url, falls back to trying to find a mapping for the old-style
"patch_project".
For now, considers only first solution (c.solutions[0]), but in theory can
be extended to all of them.
See patch_projects and repo_path_map solution config property.
Returns:
Relative path, including solution's root.
If patch_project is not given or not recognized, it'll be just first
solution root.
"""
if patch_repo:
path = self.get_repo_path(patch_repo, gclient_config=gclient_config)
if path is not None:
return path
cfg = gclient_config or self.c
root, _ = cfg.patch_projects.get(patch_project, ('', ''))
if not root:
# Failure case - assume patch is for first solution, as this is what most
# projects rely on.
return cfg.solutions[0].name
# Note, that c.patch_projects contains patch roots as
# slash(/)-separated path, which are roots of the respective project repos
# and include actual solution name in them.
return self.m.path.join(*root.split('/'))
def set_patch_repo_revision(self, gclient_config=None):
"""Updates config revision corresponding to patch_project.
......
......@@ -53,9 +53,6 @@ def RunSteps(api, patch_project, patch_repository_url):
patch_root = api.gclient.get_gerrit_patch_root(gclient_config=src_cfg)
assert patch_root == api.properties['expected_patch_root'], patch_root
api.gclient.calculate_patch_root(
patch_project, None, patch_repository_url)
api.gclient.set_patch_repo_revision()
......
......@@ -138,7 +138,7 @@ class TryserverApi(recipe_api.RecipeApi):
Argument:
patch_root: path relative to api.path['root'], usually obtained from
api.gclient.calculate_patch_root(patch_project)
api.gclient.get_gerrit_patch_root().
Returned paths will be relative to to patch_root.
"""
......
......@@ -61,7 +61,7 @@ def GenTests(api):
'git_cl description', stdout=api.raw_io.output_text('foobar'))
# The 'test_patch_root' property used below is just so that these
# tests can avoid using the gclient module to calculate the
# patch root. Normal users would use gclient.calculate_patch_root().
# patch root. Normal users would use gclient.get_gerrit_patch_root().
yield (api.test('with_git_patch') +
api.properties(
path_config='buildbot',
......
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