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

Unified Diff: recipe_modules/tryserver/api.py

Issue 1915833003: tryserver recipe_module: Add get_tags. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Minor things. Created 4 years, 7 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 | « recipe_modules/tryserver/__init__.py ('k') | recipe_modules/tryserver/example.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_modules/tryserver/api.py
diff --git a/recipe_modules/tryserver/api.py b/recipe_modules/tryserver/api.py
index 87d12e49131d5cdec0973cdb640faf6e98a3aced..d1d290d6f4629723dc6ab33254159f51d6ef1443 100644
--- a/recipe_modules/tryserver/api.py
+++ b/recipe_modules/tryserver/api.py
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import collections
import contextlib
import hashlib
@@ -278,3 +279,33 @@ class TryserverApi(recipe_api.RecipeApi):
failure_hash.hexdigest()
raise
+
+ def get_footers(self, patch_text=None):
+ """Retrieves footers from the patch description.
+
+ footers are machine readable tags embedded in commit messages. See
+ git-footers documentation for more information.
+ """
+ if patch_text is None:
+ codereview = None
+ if not self.can_apply_issue: #pragma: no cover
+ raise recipe_api.StepFailure("Cannot get tags from gerrit yet.")
+ else:
+ codereview = 'rietveld'
+ patch = (
+ self.m.properties['rietveld'].strip('/') + '/' +
+ str(self.m.properties['issue']))
+
+ patch_text = self.m.git_cl.get_description(
+ patch=patch, codereview=codereview).stdout
+
+ result = self.m.python(
+ 'parse description', self.package_repo_resource('git_footers.py'),
+ args=['--json', self.m.json.output()],
+ stdin=self.m.raw_io.input(data=patch_text))
+ return result.json.output
+
+ def get_footer(self, tag, patch_text=None):
+ """Gets a specific tag from a CL description"""
+ return self.get_footers(patch_text).get(tag, [])
+
« no previous file with comments | « recipe_modules/tryserver/__init__.py ('k') | recipe_modules/tryserver/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698