Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: rietveld.py

Issue 10272024: There is no reason to not assume that status:null isn't 'M'. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/rietveld_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 """ 102 """
103 url = '/download/issue%s_%s_%s.diff' % (issue, patchset, item) 103 url = '/download/issue%s_%s_%s.diff' % (issue, patchset, item)
104 return self.get(url) 104 return self.get(url)
105 105
106 def get_patch(self, issue, patchset): 106 def get_patch(self, issue, patchset):
107 """Returns a PatchSet object containing the details to apply this patch.""" 107 """Returns a PatchSet object containing the details to apply this patch."""
108 props = self.get_patchset_properties(issue, patchset) or {} 108 props = self.get_patchset_properties(issue, patchset) or {}
109 out = [] 109 out = []
110 for filename, state in props.get('files', {}).iteritems(): 110 for filename, state in props.get('files', {}).iteritems():
111 logging.debug('%s' % filename) 111 logging.debug('%s' % filename)
112 status = state.get('status') 112 # If not status, just assume it's a 'M'. Rietveld often gets it wrong and
113 if not status: 113 # just has status: null. Oh well.
114 raise patch.UnsupportedPatchFormat( 114 status = state.get('status') or 'M'
115 filename, 'File\'s status is None, patchset upload is incomplete.')
116 if status[0] not in ('A', 'D', 'M'): 115 if status[0] not in ('A', 'D', 'M'):
117 raise patch.UnsupportedPatchFormat( 116 raise patch.UnsupportedPatchFormat(
118 filename, 'Change with status \'%s\' is not supported.' % status) 117 filename, 'Change with status \'%s\' is not supported.' % status)
119 118
120 svn_props = self.parse_svn_properties( 119 svn_props = self.parse_svn_properties(
121 state.get('property_changes', ''), filename) 120 state.get('property_changes', ''), filename)
122 121
123 if state.get('is_binary'): 122 if state.get('is_binary'):
124 if status[0] == 'D': 123 if status[0] == 'D':
125 if status[0] != status.strip(): 124 if status[0] != status.strip():
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 if not 'Name or service not known' in e.reason: 331 if not 'Name or service not known' in e.reason:
333 # Usually internal GAE flakiness. 332 # Usually internal GAE flakiness.
334 raise 333 raise
335 # If reaching this line, loop again. Uses a small backoff. 334 # If reaching this line, loop again. Uses a small backoff.
336 time.sleep(1+maxtries*2) 335 time.sleep(1+maxtries*2)
337 finally: 336 finally:
338 upload.ErrorExit = old_error_exit 337 upload.ErrorExit = old_error_exit
339 338
340 # DEPRECATED. 339 # DEPRECATED.
341 Send = get 340 Send = get
OLDNEW
« no previous file with comments | « no previous file | tests/rietveld_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698