Simple File Diff Tool in Python. It's very slow (not only because it's written in Python, but also because it uses O(N²) algorithm) and implemented for educational purposes. Don't use it for anything real.
$ ./piff.py diff file1.txt file2.txt > file.patch
$ ./piff.py patch file1.txt file.patch
$ diff -u file1.txt file2.txt # verify that file1.txt was actually turned into file2.txt
Piff uses custom patch format. Here is its ABNF:
patch = *(action SP row SP line LF)
action = 'A' / 'R'
row = 1*DIGIT
line = *OCTET
action
'A'
means add theline
after indexrow
action
'R'
means remove theline
after indexrow
Here is an example of how it usually looks like:
A 4 Duis aute irure in dolor reprehenderit in voluptate velit
R 4 Duis aute irure dolor in reprehenderit in voluptate velit
A 7 asjdklaskldja
R 7 mollit anim id est laborum.