Can I create a patch with the difflib python module that is compatible with the GNU patch? I tried using unified_diff and context_diff, and also tried to specify lineterm as "\ n", but I'm still executing this error:
[ intense@Singularity Desktop]$ patch diff.patch test.txt patch unexpectedly ends in middle of line patch: **** Only garbage was found in the patch input.
I used file.writelines (diff) to write the patch to a file (code snippet http://pastebin.com/3HAWfwVf )
File test.txt:
Hello, this is test blah
File test2.txt:
Hello, this is test blah, dfsgjdfgj lfkdjgkldfjgkldfjgkl
And the generated patch:
--- /home/intense/Desktop/test.txt +++ /home/intense/Desktop/test2.txt @@ -1,2 +1,7 @@ -Hello, this is test -blah+Hello,+this+is+test+blah,+dfsgjdfgj+lfkdjgkldfjgkldfjgkl
Thanks for any help.
source share