Fix deleted empty files.
Add relevant new tests.
R=dpranke@chromium.org
BUG=
TEST=
Review URL: http://codereview.chromium.org/8539016
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@109692 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/patch.py b/patch.py
index 4c96de3..4a67cad 100644
--- a/patch.py
+++ b/patch.py
@@ -289,7 +289,13 @@
(match.group(1), line))
return
- # Ignore "deleted file mode 100644" since it's not needed.
+ match = re.match(r'^deleted file mode (\d{6})$', line)
+ if match:
+ # It is necessary to parse it because there may be no hunk, like when the
+ # file was empty.
+ self.is_delete = True
+ return
+
match = re.match(r'^new(| file) mode (\d{6})$', line)
if match:
mode = match.group(2)
@@ -297,6 +303,7 @@
# TODO(maruel): Add support to remove a property.
if bool(int(mode[4]) & 1):
self.svn_properties.append(('svn:executable', '*'))
+ return
match = re.match(r'^--- (.*)$', line)
if match: