OLD | NEW |
(Empty) | |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 from recipe_engine import recipe_api |
| 6 |
| 7 PATCH_STORAGE_GIT = 'git' |
| 8 |
| 9 class HackyTryserverDetectionApi(recipe_api.RecipeApi): |
| 10 @property |
| 11 def patch_url(self): |
| 12 """Reads patch_url property and corrects it if needed.""" |
| 13 url = self.m.properties.get('patch_url') |
| 14 return url |
| 15 |
| 16 @property |
| 17 def is_tryserver(self): |
| 18 """Returns true iff we can apply_issue or patch.""" |
| 19 return (self.can_apply_issue or self.is_patch_in_svn or |
| 20 self.is_patch_in_git or self.is_gerrit_issue) |
| 21 |
| 22 @property |
| 23 def can_apply_issue(self): |
| 24 """Returns true iff the properties exist to apply_issue from rietveld.""" |
| 25 return (self.m.properties.get('rietveld') |
| 26 and 'issue' in self.m.properties |
| 27 and 'patchset' in self.m.properties) |
| 28 |
| 29 @property |
| 30 def is_gerrit_issue(self): |
| 31 """Returns true iff the properties exist to match a Gerrit issue.""" |
| 32 return ('event.patchSet.ref' in self.m.properties and |
| 33 'event.change.url' in self.m.properties and |
| 34 'event.change.id' in self.m.properties) |
| 35 |
| 36 @property |
| 37 def is_patch_in_svn(self): |
| 38 """Returns true iff the properties exist to patch from a patch URL.""" |
| 39 return self.patch_url |
| 40 |
| 41 @property |
| 42 def is_patch_in_git(self): |
| 43 return (self.m.properties.get('patch_storage') == PATCH_STORAGE_GIT and |
| 44 self.m.properties.get('patch_repo_url') and |
| 45 self.m.properties.get('patch_ref')) |
| 46 |
OLD | NEW |