Good news! A new and updated version of the patch crate has been released!

Patch is a Rust library for parsing and producing patch files (diffs) in the Unified Format.

The Unified Format

Patch files in the unified format look like this:

--- lao 2002-02-21 23:30:39.942229878 -0800 +++ tzu 2002-02-21 23:30:50.442260588 -0800 @@ -1,7 +1,6 @@ -The Way that can be told of is not the eternal Way; -The name that can be named is not the eternal name. The Nameless is the origin of Heaven and Earth; -The Named is the mother of all things. +The named is the mother of all things. + Therefore let there always be non-being, so we may see their subtlety, And let there always be being, @@ -9,3 +8,6 @@ The two are the same, But after they are produced, they have different names. +They both may be called deep and profound. +Deeper and more profound, +The door of all subtleties!

You can parse this file into Rust types, or create instances of those types yourself and format that into a patch file.

The Documentation has more information about what you can do with the crate, including some examples. Check it out!

Release Highlights

The crate is now using the Rust 2018 Edition!

Every struct, enum and field is now completely documented

You can parse either a single patch or multiple patches which means this library can now parse entire diffs

You can format patches in the Unified Format using the Display trait on the Patch struct. let patch = Patch { ... }; println!("{}", patch); // prints a patch formatted like the one above!

trait on the struct. Parse diffs from git, svn, hg, etc. The parser is now smart enough to ignore a lot of the extra lines and context that those programs produce in their diffs

Many bug fixes and general improvements including many more tests in the codebase to make sure everything is working!