Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: infra/recipe_modules/rietveld/api.py

Issue 1641363002: Adds bot_update to depot_tools. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Don't delete the old files in this CL. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « infra/recipe_modules/rietveld/__init__.py ('k') | infra/recipe_modules/rietveld/example.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra/recipe_modules/rietveld/api.py
diff --git a/infra/recipe_modules/rietveld/api.py b/infra/recipe_modules/rietveld/api.py
new file mode 100644
index 0000000000000000000000000000000000000000..a80c93af6059247117b873da9f83caa873721f5f
--- /dev/null
+++ b/infra/recipe_modules/rietveld/api.py
@@ -0,0 +1,45 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import urlparse
+
+from recipe_engine import recipe_api
+
+class RietveldApi(recipe_api.RecipeApi):
+ def calculate_issue_root(self, extra_patch_project_roots=None):
+ """Returns path where a patch should be applied to based on "patch_project".
+
+ Maps Rietveld's "patch_project" to a path of directories relative to
+ api.gclient.c.solutions[0].name which describe where to place the patch.
+
+ Args:
+ extra_patch_project_roots: Dict mapping project names to relative roots.
+
+ Returns:
+ Relative path or empty string if patch_project is not set or path for a
+ given is unknown.
+ """
+ # Property 'patch_project' is set by Rietveld, 'project' is set by git-try
+ # when TRYSERVER_PROJECT is present in codereview.settings.
+ patch_project = (self.m.properties.get('patch_project') or
+ self.m.properties.get('project'))
+
+ # Please avoid adding projects into this hard-coded list unless your project
+ # CLs are being run by multiple recipes. Instead pass patch_project_roots to
+ # ensure_checkout.
+ patch_project_roots = {
+ 'angle/angle': ['third_party', 'angle'],
+ 'blink': ['third_party', 'WebKit'],
+ 'v8': ['v8'],
+ 'luci-py': ['luci'],
+ 'recipes-py': ['recipes-py'],
+ }
+
+ # Make sure to update common projects (above) with extra projects (and not
+ # vice versa, so that recipes can override default values if needed.
+ if extra_patch_project_roots:
+ patch_project_roots.update(extra_patch_project_roots)
+
+ path_parts = patch_project_roots.get(patch_project)
+ return self.m.path.join(*path_parts) if path_parts else ''
« no previous file with comments | « infra/recipe_modules/rietveld/__init__.py ('k') | infra/recipe_modules/rietveld/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698