Commit 378a419f authored by maruel@chromium.org's avatar maruel@chromium.org

git diff can have 'new file mode' for new files and 'new mode' for current files

R=dpranke@chromium.org
BUG=
TEST=

Review URL: http://codereview.chromium.org/7065074

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@87979 0039d316-1c4b-4281-b951-d872f2087c98
parent 4869bcfb
...@@ -215,10 +215,10 @@ class FilePatchDiff(FilePatchBase): ...@@ -215,10 +215,10 @@ class FilePatchDiff(FilePatchBase):
"""Processes a single line of the header. """Processes a single line of the header.
Returns True if it should continue looping. 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) match = re.match(r'^(rename|copy) from (.+)$', line)
if match: if match:
if old != match.group(2): if old != match.group(2):
...@@ -229,9 +229,6 @@ class FilePatchDiff(FilePatchBase): ...@@ -229,9 +229,6 @@ class FilePatchDiff(FilePatchBase):
(match.group(1), line)) (match.group(1), line))
return return
# Handle these:
# rename to <>
# copy to <>
match = re.match(r'^(rename|copy) to (.+)$', line) match = re.match(r'^(rename|copy) to (.+)$', line)
if match: if match:
if new != match.group(2): if new != match.group(2):
...@@ -242,15 +239,14 @@ class FilePatchDiff(FilePatchBase): ...@@ -242,15 +239,14 @@ class FilePatchDiff(FilePatchBase):
(match.group(1), line)) (match.group(1), line))
return 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: if match:
mode = match.group(1) mode = match.group(2)
# Only look at owner ACL for executable. # Only look at owner ACL for executable.
# TODO(maruel): Add support to remove a property.
if bool(int(mode[4]) & 1): if bool(int(mode[4]) & 1):
self.svn_properties.append(('svn:executable', '*')) self.svn_properties.append(('svn:executable', '*'))
# Handle "--- "
match = re.match(r'^--- (.*)$', line) match = re.match(r'^--- (.*)$', line)
if match: if match:
if last_line[:3] in ('---', '+++'): if last_line[:3] in ('---', '+++'):
...@@ -263,7 +259,6 @@ class FilePatchDiff(FilePatchBase): ...@@ -263,7 +259,6 @@ class FilePatchDiff(FilePatchBase):
self._fail('Missing git diff output name.') self._fail('Missing git diff output name.')
return return
# Handle "+++ "
match = re.match(r'^\+\+\+ (.*)$', line) match = re.match(r'^\+\+\+ (.*)$', line)
if match: if match:
if not last_line.startswith('---'): if not last_line.startswith('---'):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment