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

Side by Side Diff: rietveld.py

Issue 6874006: Add support for A+ files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: . Created 9 years, 3 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/patch_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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 except urllib2.HTTPError, e: 148 except urllib2.HTTPError, e:
149 if e.code == 404: 149 if e.code == 404:
150 raise patch.UnsupportedPatchFormat( 150 raise patch.UnsupportedPatchFormat(
151 filename, 'File doesn\'t have a diff.') 151 filename, 'File doesn\'t have a diff.')
152 raise 152 raise
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 out.append(patch.FilePatchDiff(filename, diff, svn_props)) 158 p = patch.FilePatchDiff(filename, diff, svn_props)
159 out.append(p)
159 if status[0] == 'A': 160 if status[0] == 'A':
160 # It won't be set for empty file. 161 # It won't be set for empty file.
161 out[-1].is_new = True 162 p.is_new = True
163 if status[1] == '+' and not (p.source_filename or p.svn_properties):
164 raise patch.UnsupportedPatchFormat(
165 filename, 'Failed to process the svn properties')
162 else: 166 else:
163 raise patch.UnsupportedPatchFormat( 167 raise patch.UnsupportedPatchFormat(
164 filename, 'Change with status \'%s\' is not supported.' % status) 168 filename, 'Change with status \'%s\' is not supported.' % status)
165 169
166 return patch.PatchSet(out) 170 return patch.PatchSet(out)
167 171
168 @staticmethod 172 @staticmethod
169 def parse_svn_properties(rietveld_svn_props, filename): 173 def parse_svn_properties(rietveld_svn_props, filename):
170 """Returns a list of tuple [('property', 'newvalue')]. 174 """Returns a list of tuple [('property', 'newvalue')].
171 175
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 if retry >= (maxtries - 1): 270 if retry >= (maxtries - 1):
267 raise 271 raise
268 if not 'Name or service not known' in e.reason: 272 if not 'Name or service not known' in e.reason:
269 # Usually internal GAE flakiness. 273 # Usually internal GAE flakiness.
270 raise 274 raise
271 # If reaching this line, loop again. Uses a small backoff. 275 # If reaching this line, loop again. Uses a small backoff.
272 time.sleep(1+maxtries*2) 276 time.sleep(1+maxtries*2)
273 277
274 # DEPRECATED. 278 # DEPRECATED.
275 Send = get 279 Send = get
OLDNEW
« no previous file with comments | « patch.py ('k') | tests/patch_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698