From 52a23b3594e63f98d786c60b367e1130a5577080 Mon Sep 17 00:00:00 2001 From: Stephen Martinis Date: Mon, 6 Feb 2017 11:06:23 -0800 Subject: [PATCH] Remove svn support from tryserver module Change-Id: Ic6109dff73f6726c1b50d107dc0996d1a0d0fcf4 Reviewed-on: https://chromium-review.googlesource.com/437637 Commit-Queue: Stephen Martinis Reviewed-by: Aaron Gable Reviewed-by: Andrii Shyshkalov --- recipe_modules/tryserver/api.py | 41 +---------- .../example.expected/with_svn_patch.json | 69 ------------------- recipe_modules/tryserver/example.py | 5 +- recipe_modules/tryserver/test_api.py | 7 -- 4 files changed, 3 insertions(+), 119 deletions(-) delete mode 100644 recipe_modules/tryserver/example.expected/with_svn_patch.json delete mode 100644 recipe_modules/tryserver/test_api.py diff --git a/recipe_modules/tryserver/api.py b/recipe_modules/tryserver/api.py index 4e60181d1..86b9ac041 100644 --- a/recipe_modules/tryserver/api.py +++ b/recipe_modules/tryserver/api.py @@ -11,7 +11,6 @@ from recipe_engine import recipe_api PATCH_STORAGE_RIETVELD = 'rietveld' PATCH_STORAGE_GIT = 'git' -PATCH_STORAGE_SVN = 'svn' class TryserverApi(recipe_api.RecipeApi): @@ -19,17 +18,11 @@ class TryserverApi(recipe_api.RecipeApi): super(TryserverApi, self).__init__(*args, **kwargs) self._failure_reasons = [] - @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) + return ( + self.can_apply_issue or self.is_patch_in_git or self.is_gerrit_issue) @property def can_apply_issue(self): @@ -48,11 +41,6 @@ class TryserverApi(recipe_api.RecipeApi): '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 @@ -76,27 +64,6 @@ class TryserverApi(recipe_api.RecipeApi): self.m.step('apply patch', patch_cmd, stdin=patch_content) - def apply_from_svn(self, cwd): - """Downloads patch from patch_url using svn-export and applies it""" - # TODO(nodir): accept these properties as parameters - patch_url = self.patch_url - root = cwd - if root is None: - issue_root = self.m.rietveld.calculate_issue_root() - root = self.m.path['checkout'].join(issue_root) - - patch_file = self.m.raw_io.output('.diff') - ext = '.bat' if self.m.platform.is_win else '' - svn_cmd = ['svn' + ext, 'export', '--force', patch_url, patch_file] - - result = self.m.step('download patch', svn_cmd, - step_test_data=self.test_api.patch_content) - result.presentation.logs['patch.diff'] = ( - result.raw_io.output.split('\n')) - - patch_content = self.m.raw_io.input(result.raw_io.output) - self._apply_patch_step(patch_content=patch_content, root=root) - def apply_from_git(self, cwd): """Downloads patch from given git repo and ref and applies it""" # TODO(nodir): accept these properties as parameters @@ -134,8 +101,6 @@ class TryserverApi(recipe_api.RecipeApi): if self.can_apply_issue: return PATCH_STORAGE_RIETVELD - elif self.is_patch_in_svn: - return PATCH_STORAGE_SVN def maybe_apply_issue(self, cwd=None, authentication=None): """If we're a trybot, apply a codereview issue. @@ -152,8 +117,6 @@ class TryserverApi(recipe_api.RecipeApi): return self.m.rietveld.apply_issue( self.m.rietveld.calculate_issue_root(), authentication=authentication) - elif storage == PATCH_STORAGE_SVN: - return self.apply_from_svn(cwd) elif storage == PATCH_STORAGE_GIT: return self.apply_from_git(cwd) else: diff --git a/recipe_modules/tryserver/example.expected/with_svn_patch.json b/recipe_modules/tryserver/example.expected/with_svn_patch.json deleted file mode 100644 index fabde4f2c..000000000 --- a/recipe_modules/tryserver/example.expected/with_svn_patch.json +++ /dev/null @@ -1,69 +0,0 @@ -[ - { - "cmd": [ - "svn", - "export", - "--force", - "svn://checkout.url", - "/path/to/tmp/diff" - ], - "name": "download patch", - "~followup_annotations": [ - "@@@STEP_LOG_LINE@patch.diff@fake patch.diff content (line 1)@@@", - "@@@STEP_LOG_LINE@patch.diff@fake patch.diff content (line 2)@@@", - "@@@STEP_LOG_LINE@patch.diff@@@@", - "@@@STEP_LOG_END@patch.diff@@@" - ] - }, - { - "cmd": [ - "patch", - "--dir", - "[START_DIR]", - "--force", - "--forward", - "--remove-empty-files", - "--strip", - "0" - ], - "name": "apply patch", - "stdin": "fake patch.diff content (line 1)\nfake patch.diff content (line 2)\n" - }, - { - "cmd": [ - "git", - "diff", - "--cached", - "--name-only" - ], - "cwd": "[START_DIR]", - "name": "git diff to analyze patch", - "stdout": "/path/to/tmp/", - "~followup_annotations": [ - "@@@STEP_LOG_LINE@files@foo.cc@@@", - "@@@STEP_LOG_END@files@@@", - "@@@SET_BUILD_PROPERTY@failure_type@\"INVALID_TEST_RESULTS\"@@@", - "@@@SET_BUILD_PROPERTY@subproject_tag@\"v8\"@@@" - ] - }, - { - "cmd": [ - "python", - "-u", - "import sys; sys.exit(1)" - ], - "name": "fail", - "~followup_annotations": [ - "step returned non-zero exit code: 1", - "@@@STEP_TEXT@foo@@@", - "@@@STEP_FAILURE@@@", - "@@@SET_BUILD_PROPERTY@failure_hash@\"c2311ad770732eade3d2f48247abd147e40a70e7\"@@@" - ] - }, - { - "name": "$result", - "reason": "Step('fail') failed with return_code 1", - "recipe_result": null, - "status_code": 1 - } -] \ No newline at end of file diff --git a/recipe_modules/tryserver/example.py b/recipe_modules/tryserver/example.py index f73c41a5b..68c30d30d 100644 --- a/recipe_modules/tryserver/example.py +++ b/recipe_modules/tryserver/example.py @@ -49,9 +49,6 @@ def RunSteps(api): def GenTests(api): description_step = api.override_step_data( 'git_cl description', stdout=api.raw_io.output('foobar')) - yield (api.test('with_svn_patch') + - api.properties(patch_url='svn://checkout.url')) - yield (api.test('with_git_patch') + api.properties( path_config='buildbot', @@ -112,4 +109,4 @@ def GenTests(api): ) yield (api.test('set_failure_hash_with_no_steps') + - api.properties(set_failure_hash_with_no_steps=True)) \ No newline at end of file + api.properties(set_failure_hash_with_no_steps=True)) diff --git a/recipe_modules/tryserver/test_api.py b/recipe_modules/tryserver/test_api.py deleted file mode 100644 index 1bb8e0dcf..000000000 --- a/recipe_modules/tryserver/test_api.py +++ /dev/null @@ -1,7 +0,0 @@ -from recipe_engine import recipe_test_api - -class TryserverTestApi(recipe_test_api.RecipeTestApi): - def patch_content(self): - return self.m.raw_io.output( - 'fake patch.diff content (line 1)\n' - 'fake patch.diff content (line 2)\n')