| OLD | NEW |
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 """Defines class Rietveld to easily access a rietveld instance. | 5 """Defines class Rietveld to easily access a rietveld instance. |
| 6 | 6 |
| 7 Security implications: | 7 Security implications: |
| 8 | 8 |
| 9 The following hypothesis are made: | 9 The following hypothesis are made: |
| 10 - Rietveld enforces: | 10 - Rietveld enforces: |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 def get_patch(self, issue, patchset): | 107 def get_patch(self, issue, patchset): |
| 108 """Returns a PatchSet object containing the details to apply this patch.""" | 108 """Returns a PatchSet object containing the details to apply this patch.""" |
| 109 props = self.get_patchset_properties(issue, patchset) or {} | 109 props = self.get_patchset_properties(issue, patchset) or {} |
| 110 out = [] | 110 out = [] |
| 111 for filename, state in props.get('files', {}).iteritems(): | 111 for filename, state in props.get('files', {}).iteritems(): |
| 112 logging.debug('%s' % filename) | 112 logging.debug('%s' % filename) |
| 113 # If not status, just assume it's a 'M'. Rietveld often gets it wrong and | 113 # If not status, just assume it's a 'M'. Rietveld often gets it wrong and |
| 114 # just has status: null. Oh well. | 114 # just has status: null. Oh well. |
| 115 status = state.get('status') or 'M' | 115 status = state.get('status') or 'M' |
| 116 if status[0] not in ('A', 'D', 'M'): | 116 if status[0] not in ('A', 'D', 'M', 'R'): |
| 117 raise patch.UnsupportedPatchFormat( | 117 raise patch.UnsupportedPatchFormat( |
| 118 filename, 'Change with status \'%s\' is not supported.' % status) | 118 filename, 'Change with status \'%s\' is not supported.' % status) |
| 119 | 119 |
| 120 svn_props = self.parse_svn_properties( | 120 svn_props = self.parse_svn_properties( |
| 121 state.get('property_changes', ''), filename) | 121 state.get('property_changes', ''), filename) |
| 122 | 122 |
| 123 if state.get('is_binary'): | 123 if state.get('is_binary'): |
| 124 if status[0] == 'D': | 124 if status[0] == 'D': |
| 125 if status[0] != status.strip(): | 125 if status[0] != status.strip(): |
| 126 raise patch.UnsupportedPatchFormat( | 126 raise patch.UnsupportedPatchFormat( |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 if not 'Name or service not known' in e.reason: | 336 if not 'Name or service not known' in e.reason: |
| 337 # Usually internal GAE flakiness. | 337 # Usually internal GAE flakiness. |
| 338 raise | 338 raise |
| 339 # If reaching this line, loop again. Uses a small backoff. | 339 # If reaching this line, loop again. Uses a small backoff. |
| 340 time.sleep(1+maxtries*2) | 340 time.sleep(1+maxtries*2) |
| 341 finally: | 341 finally: |
| 342 upload.ErrorExit = old_error_exit | 342 upload.ErrorExit = old_error_exit |
| 343 | 343 |
| 344 # DEPRECATED. | 344 # DEPRECATED. |
| 345 Send = get | 345 Send = get |
| OLD | NEW |