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

Unified Diff: infra/recipe_modules/hacky_tryserver_detection/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
Index: infra/recipe_modules/hacky_tryserver_detection/api.py
diff --git a/infra/recipe_modules/hacky_tryserver_detection/api.py b/infra/recipe_modules/hacky_tryserver_detection/api.py
new file mode 100644
index 0000000000000000000000000000000000000000..5cd4e18aeb4dede51e24b26074c6d946d2a44a69
--- /dev/null
+++ b/infra/recipe_modules/hacky_tryserver_detection/api.py
@@ -0,0 +1,46 @@
+# Copyright 2014 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.
+
+from recipe_engine import recipe_api
+
+PATCH_STORAGE_GIT = 'git'
+
+class HackyTryserverDetectionApi(recipe_api.RecipeApi):
+ @property
+ def patch_url(self):
+ """Reads patch_url property and corrects it if needed."""
+ url = self.m.properties.get('patch_url')
+ return url
+
+ @property
+ def is_tryserver(self):
+ """Returns true iff we can apply_issue or patch."""
+ return (self.can_apply_issue or self.is_patch_in_svn or
+ self.is_patch_in_git or self.is_gerrit_issue)
+
+ @property
+ def can_apply_issue(self):
+ """Returns true iff the properties exist to apply_issue from rietveld."""
+ return (self.m.properties.get('rietveld')
+ and 'issue' in self.m.properties
+ and 'patchset' in self.m.properties)
+
+ @property
+ def is_gerrit_issue(self):
+ """Returns true iff the properties exist to match a Gerrit issue."""
+ return ('event.patchSet.ref' in self.m.properties and
+ 'event.change.url' in self.m.properties and
+ 'event.change.id' in self.m.properties)
+
+ @property
+ def is_patch_in_svn(self):
+ """Returns true iff the properties exist to patch from a patch URL."""
+ return self.patch_url
+
+ @property
+ def is_patch_in_git(self):
+ return (self.m.properties.get('patch_storage') == PATCH_STORAGE_GIT and
+ self.m.properties.get('patch_repo_url') and
+ self.m.properties.get('patch_ref'))
+
« no previous file with comments | « infra/recipe_modules/hacky_tryserver_detection/__init__.py ('k') | infra/recipe_modules/hacky_tryserver_detection/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698