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

Side by Side Diff: rietveld.py

Issue 7054048: Increase coverage to 91%; Much stricter about header parsing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Address review comments Created 9 years, 6 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 | « patch.py ('k') | tests/checkout_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) 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 out.append(patch.FilePatchDelete(filename, state['is_binary'])) 126 out.append(patch.FilePatchDelete(filename, state['is_binary']))
127 elif status in ('A', 'M'): 127 elif status in ('A', 'M'):
128 # TODO(maruel): Rietveld support is still weird, add this line once it's 128 # TODO(maruel): Rietveld support is still weird, add this line once it's
129 # safe to use. 129 # safe to use.
130 # props = state.get('property_changes', '').splitlines() or [] 130 # props = state.get('property_changes', '').splitlines() or []
131 props = [] 131 props = []
132 if state['is_binary']: 132 if state['is_binary']:
133 out.append(patch.FilePatchBinary( 133 out.append(patch.FilePatchBinary(
134 filename, 134 filename,
135 self.get_file_content(issue, patchset, state['id']), 135 self.get_file_content(issue, patchset, state['id']),
136 props)) 136 props,
137 is_new=(status[0] == 'A')))
137 else: 138 else:
138 if state['num_chunks']: 139 if state['num_chunks']:
139 diff = self.get_file_diff(issue, patchset, state['id']) 140 diff = self.get_file_diff(issue, patchset, state['id'])
140 else: 141 else:
141 raise patch.UnsupportedPatchFormat( 142 raise patch.UnsupportedPatchFormat(
142 filename, 'File doesn\'t have a diff.') 143 filename, 'File doesn\'t have a diff.')
143 out.append(patch.FilePatchDiff(filename, diff, props)) 144 out.append(patch.FilePatchDiff(filename, diff, props))
144 else: 145 else:
145 # Line too long (N/80) 146 # Line too long (N/80)
146 # pylint: disable=C0301 147 # pylint: disable=C0301
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 if retry >= (maxtries - 1): 205 if retry >= (maxtries - 1):
205 raise 206 raise
206 if not 'Name or service not known' in e.reason: 207 if not 'Name or service not known' in e.reason:
207 # Usually internal GAE flakiness. 208 # Usually internal GAE flakiness.
208 raise 209 raise
209 # If reaching this line, loop again. Uses a small backoff. 210 # If reaching this line, loop again. Uses a small backoff.
210 time.sleep(1+maxtries*2) 211 time.sleep(1+maxtries*2)
211 212
212 # DEPRECATED. 213 # DEPRECATED.
213 Send = get 214 Send = get
OLDNEW
« no previous file with comments | « patch.py ('k') | tests/checkout_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698