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

Unified Diff: patch.py

Issue 7056045: Add support for executables in git-svn patches applied on svn. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/patch_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: patch.py
diff --git a/patch.py b/patch.py
index bac992d43603fafb68cf7585f11f17b61e4ef3dc..c627f48c85b79a8ab1c65da9b30e654d012d4db1 100644
--- a/patch.py
+++ b/patch.py
@@ -97,7 +97,6 @@ class FilePatchDiff(FilePatchBase):
self.patchlevel = 0
if self.is_git_diff:
self._verify_git_header()
- assert not svn_properties
else:
self._verify_svn_header()
@@ -197,6 +196,7 @@ class FilePatchDiff(FilePatchBase):
self._fail('Unexpected git diff; couldn\'t find git header.')
# Handle these:
+ # new file mode \d{6}
# rename from <>
# rename to <>
# copy from <>
@@ -204,18 +204,26 @@ class FilePatchDiff(FilePatchBase):
while lines:
if lines[0].startswith('--- '):
break
- match = re.match(r'^(rename|copy) from (.+)$', lines.pop(0))
- if not match:
+ line = lines.pop(0)
+ match = re.match(r'^(rename|copy) from (.+)$', line)
+ if match:
+ if old != match.group(2):
+ self._fail('Unexpected git diff input name for %s.' % match.group(1))
+ if not lines:
+ self._fail('Missing git diff output name for %s.' % match.group(1))
+ match = re.match(r'^(rename|copy) to (.+)$', lines.pop(0))
+ if not match:
+ self._fail('Missing git diff output name for %s.' % match.group(1))
+ if new != match.group(2):
+ self._fail('Unexpected git diff output name for %s.' % match.group(1))
continue
- if old != match.group(2):
- self._fail('Unexpected git diff input name for %s.' % match.group(1))
- if not lines:
- self._fail('Missing git diff output name for %s.' % match.group(1))
- match = re.match(r'^(rename|copy) to (.+)$', lines.pop(0))
- if not match:
- self._fail('Missing git diff output name for %s.' % match.group(1))
- if new != match.group(2):
- self._fail('Unexpected git diff output name for %s.' % match.group(1))
+
+ match = re.match(r'^new file mode (\d{6})$', line)
+ if match:
+ mode = match.group(1)
+ # Only look at owner ACL for executable.
+ if bool(int(mode[4]) & 4):
+ self.svn_properties.append(('svn:executable', '*'))
# Handle ---/+++
while lines:
« no previous file with comments | « no previous file | tests/patch_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698