#diff-patch-merge #unified-diff #patch

flickzeug

A fork of diffy: diff, patch, and merge library featuring Myers' algorithm, unified diff format parsing, fuzzy patch application, and three-way merge with conflict detection

4 releases

Uses new Rust 2024

0.4.5 Jan 15, 2026
0.4.4 Jan 2, 2026
0.4.3 Dec 17, 2025
0.4.2 Dec 17, 2025

#241 in Text processing

Download history 29/week @ 2025-12-13 8/week @ 2025-12-27 180/week @ 2026-01-03 1054/week @ 2026-01-10 1812/week @ 2026-01-17 1248/week @ 2026-01-24 2330/week @ 2026-01-31 2603/week @ 2026-02-07

8,362 downloads per month
Used in 2 crates

MIT/Apache

220KB
5.5K SLoC

flickzeug

Flickzeug Banner

flickzeug on crates.io Documentation (latest release) License License

A Rust library for computing diffs, parsing and applying patches, and performing three-way merges.

Note: This is a fork of diffy maintained by prefix.dev.

Highlights

  • Fuzzy patch application: Apply patches even when line numbers have drifted or context has slightly changed — essential for real-world patching scenarios
  • Battle-tested: Used in production with thousands of real-world patches from conda-forge, the community-driven collection of conda packages

Features

  • Diff creation: Compute differences between texts using Myers' diff algorithm, producing minimal edit sequences
  • Patch parsing & formatting: Read and write unified diff format (compatible with git diff, diff -u, etc.)
  • Fuzzy patch application: Apply patches with configurable fuzzy matching when line numbers don't align exactly, using similarity-based line matching
  • Three-way merge: Merge changes from two sources against a common ancestor, with conflict detection and multiple conflict marker styles
  • Binary support: All major APIs have *_bytes variants for working with non-UTF-8 content

Usage

Add flickzeug to your Cargo.toml:

[dependencies]
flickzeug = "0.4"

Creating a diff

use flickzeug::create_patch;

let original = "The quick brown fox\njumps over\nthe lazy dog.\n";
let modified = "The quick brown cat\njumps over\nthe sleepy dog.\n";

let patch = create_patch(original, modified);
println!("{}", patch);

Applying a patch

use flickzeug::{apply, Patch};

let original = "The quick brown fox\njumps over\nthe lazy dog.\n";
let patch_text = "..."; // unified diff format

let patch = Patch::from_str(patch_text).unwrap();
let result = apply(original, &patch).unwrap();

Three-way merge

use flickzeug::merge;

let base = "line1\nline2\nline3\n";
let ours = "line1\nmodified by us\nline3\n";
let theirs = "line1\nline2\nline3 changed\n";

let merged = merge(base, ours, theirs).unwrap();

License

This project is available under the terms of either the Apache 2.0 license or the MIT license.

Acknowledgments

This project is a fork of diffy by Brandon Williams. We thank the original author for their excellent work.

Dependencies

~0.3–2.5MB
~48K SLoC