[MERGE] Fix for bug 303569: shelving a patch with no new line at end of file fails
John Arbash Meinel
john at arbash-meinel.com
Wed Feb 25 21:19:01 GMT 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Benoît PIERRE wrote:
> The code in partches.parse_patch doesn't correctly handle a
> patch with the marker '\ No newline at end of file' to indicate
> a line doesn't end with a newline: the hunk doesn't account for
> the extra line so the loop that parses the patch will stop short
> of one line and parsing the next hunk will raise a "malformed
> hunk header" exception.
>
> This does not happen when using parse_patches since
> iter_lines_handle_nl is first called to fix all lines that must
> not end with a newline.
>
> This patch basically just move the call to iter_lines_handle_nl
> from parse_patches to parse_patch, so using the later directly
> will work. I also added a new test in test_patches.py to
> exercise both cases (patching from/to a file with no terminating
> newline).
>
>
BB:approve
Seems fine to me.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkmltcUACgkQJdeBCYSNAANsTQCgqjY/Wh7ZscN/nCtRKcF93CJE
dzAAoJFWSccxqaRGEFh95r02NkPj64hO
=e2ht
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list