[BUG] Changesets that create empty files produce bogus patches
Aaron Bentley
aaron.bentley at utoronto.ca
Wed Jul 27 07:19:32 BST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've been working on an exact-patching function for bzr. It seems very
easy. One problem I've found is that bogus patches are used by
note_patch. This happens when an empty file is added to the tree:
*** added file sub/sub/emptyfile.txt //
file-id:emptyfile.txt-20050727055518-be8239eb8f9d79ca //
text-id:emptyfile.txt-20050727055518-9810517032907c49
*** added file sub/sub/nonempty.txt ...
No patch. A patch to add an empty file might look like:
- --- /dev/null
+++ mod/sub/sub/emptyfile.txt
@@ -0,0 +1,1 @@
+
\ No newline at end of file
But we don't get anything like that in note_patch; we get an empty
string. I think we should only feed valid patches to note_patch.
Here is a patch that will let you reproduce the problem:
- --- read_changeset.py
+++ read_changeset.py
@@ -690,6 +690,7 @@
def note_patch(self, new_path, patch):
"""There is a patch for a given filename."""
+ assert len(patch) > 0, "invalid patch for %s" % new_path
self.patches[new_path] = patch
def note_deletion(self, old_path):
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFC5yd00F+nu1YWqI0RAutjAJ9/Cql6mYoxSeyPF/r1Qcy2aeT1NgCZAVlU
Rq+qRCTSuBwbUmvWTGGyjSE=
=HPQs
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list