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

Side by Side Diff: patch.py

Issue 10967071: Fix applying svn:executable on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 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 | « checkout.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 # 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
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
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]
OLDNEW
« no previous file with comments | « checkout.py ('k') | tests/patch_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698