Add better support for added and deleted empty files.
Review Request #5785 — Created May 8, 2014 and submitted — Latest diff uploaded
The addition and deletion of 0-length files were not included in the diffs of
review requests. This was especially troublesome when we needed to add or
delete an empty__init__.py
file, for example.This change adds support for including new and deleted empty files in review
requests for Git, SVN, Mercurial, and Perforce. New empty files will be
displayed with the text "This is an empty file.", and deleted empty files will
be displayed with the text "This empty file was deleted. The content cannot be
displayed." (see the attached screenshots).
I used rbt post and the "New Review Request" page to create review
requests with different Git diffs, and rbt post for SVN, Mercurial, and
Perforce diffs:
- Diff with 1 new empty file
- Diff with 2 new empty files
- Diff with 1 new empty file, 1 new non-empty file
- Diff with 1 new empty file, 2 modified files
- Diff with 1 deleted empty file
- Diff with 1 deleted empty file, 1 modified file
- Diff with 1 deleted empty file, 1 deleted non-empty file, 1 modified fileAfter this change, the 3 unit tests that tested parsing a Git diff with a new
empty file failed. (Since a new empty file is now included, the number of files
from parse() has increased by 1.)After updating the 3 unit tests to reflect this change, all unit tests pass.
The new unit tests also pass.