OLD | NEW |
---|---|
1 # Copyright 2015 The LUCI Authors. All rights reserved. | 1 # Copyright 2015 The LUCI Authors. All rights reserved. |
2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
4 | 4 |
5 import re | 5 import re |
6 import urlparse | 6 import urlparse |
7 | 7 |
8 from recipe_engine import recipe_test_api | 8 from recipe_engine import recipe_test_api |
9 | 9 |
10 class PropertiesTestApi(recipe_test_api.RecipeTestApi): | 10 class PropertiesTestApi(recipe_test_api.RecipeTestApi): |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 parsed = list(urlparse.urlparse(git_url)) | 78 parsed = list(urlparse.urlparse(git_url)) |
79 m = re.match(r'^((\w+)(-\w+)*).googlesource.com$', parsed[1]) | 79 m = re.match(r'^((\w+)(-\w+)*).googlesource.com$', parsed[1]) |
80 if not m: # pragma: no cover | 80 if not m: # pragma: no cover |
81 raise AssertionError('Can\'t guess gerrit_url from git_url "%s", ' | 81 raise AssertionError('Can\'t guess gerrit_url from git_url "%s", ' |
82 'specify it as extra kwarg' % parsed[1]) | 82 'specify it as extra kwarg' % parsed[1]) |
83 parsed[1] = m.group(1) + '-review.googlesource.com' | 83 parsed[1] = m.group(1) + '-review.googlesource.com' |
84 gerrit_url = urlparse.urlunparse(parsed[:2] + [''] * len(parsed[2:])) | 84 gerrit_url = urlparse.urlunparse(parsed[:2] + [''] * len(parsed[2:])) |
85 assert project | 85 assert project |
86 assert git_url | 86 assert git_url |
87 assert gerrit_url | 87 assert gerrit_url |
88 # Pop old style values from kwargs. | 88 # Support old and new style patch{set,issue} specification. |
89 patch_issue = int(kwargs.pop('issue', 456789)) | 89 patch_issue = int(kwargs.pop('issue', kwargs.pop('patch_issue',456789))) |
Michael Achenbach
2016/11/01 20:01:13
nit: space after comma
tandrii(chromium)
2016/11/02 23:23:59
Done.
| |
90 patch_set = int(kwargs.pop('patchset', 12)) | 90 patch_set = int(kwargs.pop('patchset', kwargs.pop('patch_set', 12))) |
91 # Note that new Gerrit patch properties all start with 'patch_' prefix. | 91 # Note that new Gerrit patch properties all start with 'patch_' prefix. |
92 ret = self.generic( | 92 ret = self.generic( |
93 patch_storage='gerrit', | 93 patch_storage='gerrit', |
94 patch_gerrit_url=gerrit_url, | 94 patch_gerrit_url=gerrit_url, |
95 patch_project=project, | 95 patch_project=project, |
96 patch_branch='master', | 96 patch_branch='master', |
97 patch_issue=patch_issue, | 97 patch_issue=patch_issue, |
98 patch_set=patch_set, | 98 patch_set=patch_set, |
99 patch_repository_url=git_url, | 99 patch_repository_url=git_url, |
100 patch_ref='refs/changes/%2d/%d/%d' % ( | 100 patch_ref='refs/changes/%2d/%d/%d' % ( |
(...skipping 19 matching lines...) Expand all Loading... | |
120 patchset=1, | 120 patchset=1, |
121 project='chrome', | 121 project='chrome', |
122 repository='', | 122 repository='', |
123 requester='commit-bot@chromium.org', | 123 requester='commit-bot@chromium.org', |
124 revision='HEAD', | 124 revision='HEAD', |
125 rietveld='https://codereview.chromium.org', | 125 rietveld='https://codereview.chromium.org', |
126 patch_project='chromium', | 126 patch_project='chromium', |
127 ) | 127 ) |
128 ret.properties.update(kwargs) | 128 ret.properties.update(kwargs) |
129 return ret | 129 return ret |
OLD | NEW |