Skip to content
forked from tsoding/piff

Simple File Diff Tool in Python

License

Notifications You must be signed in to change notification settings

a-michelis/piff

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Piff

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.

Quick Start

$ ./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

Patch Format

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 the line after index row
  • action 'R' means remove the line after index row

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.

References

About

Simple File Diff Tool in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%