| OLD | NEW |
| 1 # coding=utf8 | 1 # coding=utf8 |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 # It is necessary to parse it because there may be no hunk, like when the | 398 # It is necessary to parse it because there may be no hunk, like when the |
| 399 # file was empty. | 399 # file was empty. |
| 400 self.is_delete = True | 400 self.is_delete = True |
| 401 return | 401 return |
| 402 | 402 |
| 403 match = re.match(r'^new(| file) mode (\d{6})$', line) | 403 match = re.match(r'^new(| file) mode (\d{6})$', line) |
| 404 if match: | 404 if match: |
| 405 mode = match.group(2) | 405 mode = match.group(2) |
| 406 # Only look at owner ACL for executable. | 406 # Only look at owner ACL for executable. |
| 407 if bool(int(mode[4]) & 1): | 407 if bool(int(mode[4]) & 1): |
| 408 self.svn_properties.append(('svn:executable', '*')) | 408 self.svn_properties.append(('svn:executable', '.')) |
| 409 elif not self.source_filename and self.is_new: | 409 elif not self.source_filename and self.is_new: |
| 410 # It's a new file, not from a rename/copy, then there's no property to | 410 # It's a new file, not from a rename/copy, then there's no property to |
| 411 # delete. | 411 # delete. |
| 412 self.svn_properties.append(('svn:executable', None)) | 412 self.svn_properties.append(('svn:executable', None)) |
| 413 return | 413 return |
| 414 | 414 |
| 415 match = re.match(r'^--- (.*)$', line) | 415 match = re.match(r'^--- (.*)$', line) |
| 416 if match: | 416 if match: |
| 417 if last_line[:3] in ('---', '+++'): | 417 if last_line[:3] in ('---', '+++'): |
| 418 self._fail('--- and +++ are reversed') | 418 self._fail('--- and +++ are reversed') |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 def __iter__(self): | 523 def __iter__(self): |
| 524 for patch in self.patches: | 524 for patch in self.patches: |
| 525 yield patch | 525 yield patch |
| 526 | 526 |
| 527 def __getitem__(self, key): | 527 def __getitem__(self, key): |
| 528 return self.patches[key] | 528 return self.patches[key] |
| 529 | 529 |
| 530 @property | 530 @property |
| 531 def filenames(self): | 531 def filenames(self): |
| 532 return [p.filename for p in self.patches] | 532 return [p.filename for p in self.patches] |
| OLD | NEW |