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

Unified Diff: recipe_modules/tryserver/api.py

Issue 2249983004: Add apply_gerrit_ref to bot_update api (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Use bot_update Created 4 years, 4 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 | « no previous file | no next file » | 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 f18c2b5d93227ffe0cf4c351de2dcf3b64dbfdb3..889ce8606de114f272691c88fe1a5d412af6152d 100644
--- a/recipe_modules/tryserver/api.py
+++ b/recipe_modules/tryserver/api.py
@@ -5,11 +5,21 @@
import collections
import contextlib
import hashlib
+import os
+import sys
+import uuid
from recipe_engine import recipe_api
+# Construct path to bot_update.
+sys.path.append(
+ os.path.abspath(
+ os.path.join(os.path.realpath(__file__), os.pardir, os.pardir,
+ 'bot_update', 'resources')))
+import bot_update
rmistry 2016/08/18 18:39:51 Did not want to duplicate all the work already don
tandrii(chromium) 2016/08/18 18:54:13 that's bad. And it's against the spirit of recipes
rmistry 2016/08/18 20:27:50 It does work (I tried it out locally). Could I in
tandrii(chromium) 2016/08/18 20:30:09 That OR wdyt about adding new API in bot_update +
PATCH_STORAGE_RIETVELD = 'rietveld'
+PATCH_STORAGE_GERRIT = 'gerrit'
PATCH_STORAGE_GIT = 'git'
PATCH_STORAGE_SVN = 'svn'
@@ -136,11 +146,19 @@ class TryserverApi(recipe_api.RecipeApi):
None, 'oauth2' (see also api.rietveld.apply_issue.)
"""
storage = self.determine_patch_storage()
-
if storage == PATCH_STORAGE_RIETVELD:
return self.m.rietveld.apply_issue(
self.m.rietveld.calculate_issue_root(),
authentication=authentication)
+ elif storage == PATCH_STORAGE_GERRIT:
+ patch_project = (self.m.properties.get('patch_project') or
+ self.m.properties.get('project'))
+ return bot_update.apply_gerrit_ref(
+ gerrit_repo=self.m.properties.get('repository') or 'origin',
+ gerrit_ref=self.m.properties.get('event.patchSet.ref'),
+ root=str(self.m.path['slave_build'].join(patch_project)),
+ gerrit_reset=True,
+ gerrit_rebase_patch_ref=True)
elif storage == PATCH_STORAGE_SVN:
return self.apply_from_svn(cwd)
elif storage == PATCH_STORAGE_GIT:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698