| OLD | NEW |
| 1 # coding=utf8 | 1 # coding=utf8 |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 """Utility functions to handle patches.""" | 5 """Utility functions to handle patches.""" |
| 6 | 6 |
| 7 import posixpath | 7 import posixpath |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 | 10 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 self._fail( | 240 self._fail( |
| 241 'Confused %s from/to git diff for line %s.' % | 241 'Confused %s from/to git diff for line %s.' % |
| 242 (match.group(1), line)) | 242 (match.group(1), line)) |
| 243 return | 243 return |
| 244 | 244 |
| 245 # Handle "new file mode \d{6}" | 245 # Handle "new file mode \d{6}" |
| 246 match = re.match(r'^new file mode (\d{6})$', line) | 246 match = re.match(r'^new file mode (\d{6})$', line) |
| 247 if match: | 247 if match: |
| 248 mode = match.group(1) | 248 mode = match.group(1) |
| 249 # Only look at owner ACL for executable. | 249 # Only look at owner ACL for executable. |
| 250 if bool(int(mode[4]) & 4): | 250 if bool(int(mode[4]) & 1): |
| 251 self.svn_properties.append(('svn:executable', '*')) | 251 self.svn_properties.append(('svn:executable', '*')) |
| 252 | 252 |
| 253 # Handle "--- " | 253 # Handle "--- " |
| 254 match = re.match(r'^--- (.*)$', line) | 254 match = re.match(r'^--- (.*)$', line) |
| 255 if match: | 255 if match: |
| 256 if last_line[:3] in ('---', '+++'): | 256 if last_line[:3] in ('---', '+++'): |
| 257 self._fail('--- and +++ are reversed') | 257 self._fail('--- and +++ are reversed') |
| 258 self.is_new = match.group(1) == '/dev/null' | 258 self.is_new = match.group(1) == '/dev/null' |
| 259 # TODO(maruel): Use self.source_file. | 259 # TODO(maruel): Use self.source_file. |
| 260 if old != self.mangle(match.group(1)) and match.group(1) != '/dev/null': | 260 if old != self.mangle(match.group(1)) and match.group(1) != '/dev/null': |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 for patch in self.patches: | 347 for patch in self.patches: |
| 348 patch.set_relpath(relpath) | 348 patch.set_relpath(relpath) |
| 349 | 349 |
| 350 def __iter__(self): | 350 def __iter__(self): |
| 351 for patch in self.patches: | 351 for patch in self.patches: |
| 352 yield patch | 352 yield patch |
| 353 | 353 |
| 354 @property | 354 @property |
| 355 def filenames(self): | 355 def filenames(self): |
| 356 return [p.filename for p in self.patches] | 356 return [p.filename for p in self.patches] |
| OLD | NEW |