From 378a419f0d7f968df5581eea4f8a1bed57dde5d0 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Mon, 6 Jun 2011 13:36:02 +0000 Subject: [PATCH] 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 --- patch.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/patch.py b/patch.py index a7eef3f24..77bb15991 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('---'):