OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 """Defines class Rietveld to easily access a rietveld instance. | 4 """Defines class Rietveld to easily access a rietveld instance. |
5 | 5 |
6 Security implications: | 6 Security implications: |
7 | 7 |
8 The following hypothesis are made: | 8 The following hypothesis are made: |
9 - Rietveld enforces: | 9 - Rietveld enforces: |
10 - Nobody else than issue owner can upload a patch set | 10 - Nobody else than issue owner can upload a patch set |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 # It may happen on property-only change or svn copy without diff. | 153 # It may happen on property-only change or svn copy without diff. |
154 if not diff: | 154 if not diff: |
155 # Support this use case if it ever happen. | 155 # Support this use case if it ever happen. |
156 raise patch.UnsupportedPatchFormat( | 156 raise patch.UnsupportedPatchFormat( |
157 filename, 'Empty diff is not supported yet.\n') | 157 filename, 'Empty diff is not supported yet.\n') |
158 p = patch.FilePatchDiff(filename, diff, svn_props) | 158 p = patch.FilePatchDiff(filename, diff, svn_props) |
159 out.append(p) | 159 out.append(p) |
160 if status[0] == 'A': | 160 if status[0] == 'A': |
161 # It won't be set for empty file. | 161 # It won't be set for empty file. |
162 p.is_new = True | 162 p.is_new = True |
163 if status[1] == '+' and not (p.source_filename or p.svn_properties): | 163 if (len(status) > 1 and |
| 164 status[1] == '+' and |
| 165 not (p.source_filename or p.svn_properties)): |
164 raise patch.UnsupportedPatchFormat( | 166 raise patch.UnsupportedPatchFormat( |
165 filename, 'Failed to process the svn properties') | 167 filename, 'Failed to process the svn properties') |
166 else: | 168 else: |
167 raise patch.UnsupportedPatchFormat( | 169 raise patch.UnsupportedPatchFormat( |
168 filename, 'Change with status \'%s\' is not supported.' % status) | 170 filename, 'Change with status \'%s\' is not supported.' % status) |
169 | 171 |
170 return patch.PatchSet(out) | 172 return patch.PatchSet(out) |
171 | 173 |
172 @staticmethod | 174 @staticmethod |
173 def parse_svn_properties(rietveld_svn_props, filename): | 175 def parse_svn_properties(rietveld_svn_props, filename): |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 if retry >= (maxtries - 1): | 272 if retry >= (maxtries - 1): |
271 raise | 273 raise |
272 if not 'Name or service not known' in e.reason: | 274 if not 'Name or service not known' in e.reason: |
273 # Usually internal GAE flakiness. | 275 # Usually internal GAE flakiness. |
274 raise | 276 raise |
275 # If reaching this line, loop again. Uses a small backoff. | 277 # If reaching this line, loop again. Uses a small backoff. |
276 time.sleep(1+maxtries*2) | 278 time.sleep(1+maxtries*2) |
277 | 279 |
278 # DEPRECATED. | 280 # DEPRECATED. |
279 Send = get | 281 Send = get |
OLD | NEW |