Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 rietveld_svn_props = rietveld_svn_props.splitlines() | 180 rietveld_svn_props = rietveld_svn_props.splitlines() |
| 181 svn_props = [] | 181 svn_props = [] |
| 182 if not rietveld_svn_props: | 182 if not rietveld_svn_props: |
| 183 return svn_props | 183 return svn_props |
| 184 # 1. Ignore svn:mergeinfo. | 184 # 1. Ignore svn:mergeinfo. |
| 185 # 2. Accept svn:eol-style and svn:executable. | 185 # 2. Accept svn:eol-style and svn:executable. |
| 186 # 3. Refuse any other. | 186 # 3. Refuse any other. |
| 187 # \n | 187 # \n |
| 188 # Added: svn:ignore\n | 188 # Added: svn:ignore\n |
| 189 # + LF\n | 189 # + LF\n |
| 190 | |
| 191 spacer = rietveld_svn_props.pop(0) | |
| 192 if spacer or not rietveld_svn_props: | |
| 193 # svn diff always put a spacer between the unified diff and property | |
| 194 # diff | |
| 195 raise patch.UnsupportedPatchFormat( | |
| 196 filename, 'Failed to parse svn properties.') | |
| 197 | |
| 190 while rietveld_svn_props: | 198 while rietveld_svn_props: |
| 191 spacer = rietveld_svn_props.pop(0) | |
| 192 if spacer or not rietveld_svn_props: | |
| 193 # svn diff always put a spacer between the unified diff and property | |
| 194 # diff | |
| 195 raise patch.UnsupportedPatchFormat( | |
| 196 filename, 'Failed to parse svn properties.') | |
| 197 | |
|
Dirk Pranke
2011/09/08 18:35:36
Can you explain what the bug was here and why this
M-A Ruel
2011/09/08 18:37:58
The new unit test checks exactly that; when there'
| |
| 198 # Something like 'Added: svn:eol-style'. Note the action is localized. | 199 # Something like 'Added: svn:eol-style'. Note the action is localized. |
| 199 # *sigh*. | 200 # *sigh*. |
| 200 action = rietveld_svn_props.pop(0) | 201 action = rietveld_svn_props.pop(0) |
| 201 match = re.match(r'^(\w+): (.+)$', action) | 202 match = re.match(r'^(\w+): (.+)$', action) |
| 202 if not match or not rietveld_svn_props: | 203 if not match or not rietveld_svn_props: |
| 203 raise patch.UnsupportedPatchFormat( | 204 raise patch.UnsupportedPatchFormat( |
| 204 filename, 'Failed to parse svn properties.') | 205 filename, 'Failed to parse svn properties.') |
| 205 | 206 |
| 206 if match.group(2) == 'svn:mergeinfo': | 207 if match.group(2) == 'svn:mergeinfo': |
| 207 # Silently ignore the content. | 208 # Silently ignore the content. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 272 if retry >= (maxtries - 1): | 273 if retry >= (maxtries - 1): |
| 273 raise | 274 raise |
| 274 if not 'Name or service not known' in e.reason: | 275 if not 'Name or service not known' in e.reason: |
| 275 # Usually internal GAE flakiness. | 276 # Usually internal GAE flakiness. |
| 276 raise | 277 raise |
| 277 # If reaching this line, loop again. Uses a small backoff. | 278 # If reaching this line, loop again. Uses a small backoff. |
| 278 time.sleep(1+maxtries*2) | 279 time.sleep(1+maxtries*2) |
| 279 | 280 |
| 280 # DEPRECATED. | 281 # DEPRECATED. |
| 281 Send = get | 282 Send = get |
| OLD | NEW |