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

Unified Diff: patch.py

Issue 7065074: git diff can have 'new file mode' for new files and 'new mode' for current files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: remove redundant comments Created 9 years, 6 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 | no next file » | 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 a7eef3f24fc2f1468dc25ff35c79a999b2c83155..77bb15991065f4fefd363335e26e59cad19dffa6 100644
--- a/patch.py
+++ b/patch.py
@@ -215,10 +215,10 @@ class FilePatchDiff(FilePatchBase):
"""Processes a single line of the header.
Returns True if it should continue looping.
+
+ Format is described to
+ http://www.kernel.org/pub/software/scm/git/docs/git-diff.html
"""
- # Handle these:
- # rename from <>
- # copy from <>
match = re.match(r'^(rename|copy) from (.+)$', line)
if match:
if old != match.group(2):
@@ -229,9 +229,6 @@ class FilePatchDiff(FilePatchBase):
(match.group(1), line))
return
- # Handle these:
- # rename to <>
- # copy to <>
match = re.match(r'^(rename|copy) to (.+)$', line)
if match:
if new != match.group(2):
@@ -242,15 +239,14 @@ class FilePatchDiff(FilePatchBase):
(match.group(1), line))
return
- # Handle "new file mode \d{6}"
- match = re.match(r'^new file mode (\d{6})$', line)
+ match = re.match(r'^new(| file) mode (\d{6})$', line)
if match:
- mode = match.group(1)
+ mode = match.group(2)
# Only look at owner ACL for executable.
+ # TODO(maruel): Add support to remove a property.
if bool(int(mode[4]) & 1):
self.svn_properties.append(('svn:executable', '*'))
- # Handle "--- "
match = re.match(r'^--- (.*)$', line)
if match:
if last_line[:3] in ('---', '+++'):
@@ -263,7 +259,6 @@ class FilePatchDiff(FilePatchBase):
self._fail('Missing git diff output name.')
return
- # Handle "+++ "
match = re.match(r'^\+\+\+ (.*)$', line)
if match:
if not last_line.startswith('---'):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698