python-unidiff
python-unidiff copied to clipboard
unidiff.errors.UnidiffParseError: Unexpected hunk found: @@ -2,6 +2,6 @@
I am writing diff files using Python's difflib.unified_diff()
;
One such file commences with:
---
+++
@@ -2,6 +2,6 @@
if I try to read it then unidiff fails with:
unidiff.errors.UnidiffParseError: Unexpected hunk found: @@ -2,6 +2,6 @@
I am left suspecting, when comparing it with the README samples that the missing filename is bothering it. If so, it shouldn't really given that difflib.unified_diff()
produces output that lacks it.
Manually adding a filename as in:
--- test1
+++ test2
@@ -2,6 +2,6 @@
sees it loaded fine. Looks like I'll have to ask difflib to write those filenames out. All good I guess, though I can't help but feel as they are optional in difflib, they should rightly be optional in unidiff too. But that of course is a matter of opinion.
+1 i also have this issue