| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 out.append(patch.FilePatchDelete(filename, state['is_binary'])) | 142 out.append(patch.FilePatchDelete(filename, state['is_binary'])) |
| 143 else: | 143 else: |
| 144 content = self.get_file_content(issue, patchset, state['id']) | 144 content = self.get_file_content(issue, patchset, state['id']) |
| 145 if not content: | 145 if not content: |
| 146 # As a precaution due to a bug in upload.py for git checkout, refuse | 146 # As a precaution due to a bug in upload.py for git checkout, refuse |
| 147 # empty files. If it's empty, it's not a binary file. | 147 # empty files. If it's empty, it's not a binary file. |
| 148 raise patch.UnsupportedPatchFormat( | 148 raise patch.UnsupportedPatchFormat( |
| 149 filename, | 149 filename, |
| 150 'Binary file is empty. Maybe the file wasn\'t uploaded in the ' | 150 'Binary file is empty. Maybe the file wasn\'t uploaded in the ' |
| 151 'first place?') | 151 'first place?') |
| 152 raise patch.UnsupportedPatchFormat( | 152 out.append(patch.FilePatchBinary( |
| 153 filename, | 153 filename, |
| 154 'Binary file support is temporarilly disabled due to a bug. ' | 154 content, |
| 155 'Please commit blindly the binary files first then commit the ' | 155 svn_props, |
| 156 'source change as a separate CL. Sorry for the annoyance.') | 156 is_new=(status[0] == 'A'))) |
| 157 #out.append(patch.FilePatchBinary( | |
| 158 # filename, | |
| 159 # content, | |
| 160 # svn_props, | |
| 161 # is_new=(status[0] == 'A'))) | |
| 162 continue | 157 continue |
| 163 | 158 |
| 164 try: | 159 try: |
| 165 diff = self.get_file_diff(issue, patchset, state['id']) | 160 diff = self.get_file_diff(issue, patchset, state['id']) |
| 166 except urllib2.HTTPError, e: | 161 except urllib2.HTTPError, e: |
| 167 if e.code == 404: | 162 if e.code == 404: |
| 168 raise patch.UnsupportedPatchFormat( | 163 raise patch.UnsupportedPatchFormat( |
| 169 filename, 'File doesn\'t have a diff.') | 164 filename, 'File doesn\'t have a diff.') |
| 170 raise | 165 raise |
| 171 | 166 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 if not messages: | 438 if not messages: |
| 444 # Assumes self._lookup uses deepcopy. | 439 # Assumes self._lookup uses deepcopy. |
| 445 del data['messages'] | 440 del data['messages'] |
| 446 return data | 441 return data |
| 447 | 442 |
| 448 def get_patchset_properties(self, issue, patchset): | 443 def get_patchset_properties(self, issue, patchset): |
| 449 return self._lookup( | 444 return self._lookup( |
| 450 'get_patchset_properties', | 445 'get_patchset_properties', |
| 451 (issue, patchset), | 446 (issue, patchset), |
| 452 super(CachingRietveld, self).get_patchset_properties) | 447 super(CachingRietveld, self).get_patchset_properties) |
| OLD | NEW |