Skip to content

Rust/Python tool that creates physical copies of directory differences, making it easy to visualize and review large-scale code changes and migrations.

License

Notifications You must be signed in to change notification settings

ThalesMMS/BigDiff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BigDiff

BigDiff compares two directory trees and writes a third tree containing only the differences, with inline annotations directly in the files. This repository hosts both official implementations:

  • Rust (src/ + Cargo.toml): fast, standalone binary.
  • Python (bigdiff/ + bigdiff.py): easy to run/extend; CLI output/messages remain in Portuguese to preserve the original UX.

Choose a version by running its entrypoint; there is no wrapper that forces a selection.

What it does

  • Recursively compares Base (A) vs Target (B) and writes results to Output (C).
  • New files get a .new suffix; deleted files get .deleted.
  • Modified files get .modified with inline diff:
    • Deleted lines are preserved as comments marked DELETED.
    • Added lines are marked NEW.
    • Comment syntax matches the file type (C-like, Python, HTML, etc.).
  • Binary or oversized files are copied as .modified with a companion <file>.modified.NOTE.txt explaining why text diff was skipped.
  • Supports glob ignores, EOL normalization, and --dry-run to preview the plan.

Repository layout

  • src/, Cargo.toml: Rust implementation and dependencies.
  • bigdiff/, bigdiff.py: Python package and compatibility wrapper.
  • target/: Rust build artifacts (generated by cargo).
  • Shared project metadata: README.md, .gitignore, .gitattributes, LICENSE.

Quick start: Rust

Prerequisite: Rust toolchain (cargo + rustc).

Build:

cargo build --release
# binary at target/release/bigdiff

Run:

cargo run -- [OPTIONS] <base_dir> <target_dir> <output_dir>

Notable options:

  • -i, --ignore <glob> (repeatable or comma-separated)
  • -E, --normalize-eol normalize CRLF/LF before comparing text
  • -S, --max-text-size <size> text diff limit (e.g., 5MB)
  • --dry-run print the plan without writing files

Example:

cargo run -- ./v1 ./v2 ./diff_out --ignore "node_modules" --ignore "*.log" --normalize-eol

Quick start: Python

Prerequisite: Python 3.8+.

Run:

python -m bigdiff FOLDER1 FOLDER2 FOLDER3 [options]
# compatibility wrapper:
python bigdiff.py FOLDER1 FOLDER2 FOLDER3 [options]

Options (CLI strings are in Portuguese):

  • --ignore, -i glob patterns (repeatable or comma-separated)
  • --normalize-eol, -E normalize CRLF/LF before comparing text
  • --max-text-size, -S text diff limit (default 5MB)
  • --dry-run show the summary only

Output structure

  • name.ext.new for files only in the target tree.
  • name.ext.deleted for files only in the base tree.
  • name.ext.modified for files that differ, with inline annotations.
  • name.ext.modified.NOTE.txt explains when text diff was skipped.

License

MIT – see LICENSE.

About

Rust/Python tool that creates physical copies of directory differences, making it easy to visualize and review large-scale code changes and migrations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published