| Crates.io | diffpatch |
| lib.rs | diffpatch |
| version | 0.1.3 |
| created_at | 2025-03-22 06:51:55.788696+00 |
| updated_at | 2025-08-08 04:34:18.10596+00 |
| description | A tool to compare directories and create executable patches |
| homepage | https://github.com/LemoBits/DiffPatch |
| repository | https://github.com/LemoBits/DiffPatch |
| max_upload_size | |
| id | 1601583 |
| size | 123,877 |
A directory comparison tool written in Rust that generates executable patch files.
一个用Rust编写的目录比较工具,可以生成可执行的补丁文件。
diffpatch create --source <SOURCE_DIR> --target <TARGET_DIR> --output <PATCH_FILE> --check-files <VERIFY_FILE1,VERIFY_FILE2,...> --exclude-extensions <EXT1,EXT2,...> --exclude-dirs <DIR1,DIR2,...> --use-diff-patches
--source <DIR>: Source directory (original files)--target <DIR>: Target directory (modified files)--output <FILE>: Output patch file name (default to target directory)--check-files <FILES>: Comma-separated list of verification files that must exist in the target directory--exclude-extensions <EXTENSIONS>: Comma-separated list of file extensions to exclude (e.g., .tmp,.bak)--exclude-dirs <DIRS>: Comma-separated list of directories to exclude (e.g., node_modules,dist)--use-diff-patches <true|false>: Use file difference patches instead of storing full files (reduces patch size)You can control I/O parallelism via environment variables, especially when dealing with large directories:
# Set the number of file I/O parallel threads (default is the lesser of CPU cores and 4)
# For high-performance SSDs, you can increase this value
# For mechanical hard drives, reducing this value might be more effective
export DIFFPATCH_IO_THREADS=2
diffpatch create --source ... --target ...
Place the generated patch file in the directory that needs to be updated, and double-click to run it. The patch program will first verify that the directory is correct, then quickly apply the file changes using parallel processing.
cargo build --release
The compiled executable will be located in the target/release/ directory.
一个用Rust编写的目录比较工具,可以生成可执行的补丁文件。
diffpatch create --source <未修改的目录> --target <修改后的目录> --output <补丁文件名> --check-files <验证文件1,验证文件2,...> --exclude-extensions <排除文件后缀名1,排除文件后缀名2,...> --exclude-dirs <排除文件夹1,排除文件夹2,...> --use-diff-patches
--source <DIR>: 源目录(原始文件夹)--target <DIR>: 目标目录(修改后的文件夹)--output <FILE>: 输出补丁文件名(默认输出到目标目录)--check-files <FILES>: 逗号分隔的验证文件列表,这些文件必须存在于目标目录中--exclude-extensions <EXTENSIONS>: 逗号分隔的要排除的文件扩展名列表(例如,.tmp,.bak)--exclude-dirs <DIRS>: 逗号分隔的要排除的目录列表(例如,node_modules,dist)--use-diff-patches <true|false>: 使用文件差异补丁而不是存储完整文件(减小补丁大小)可以通过环境变量控制I/O并行度,特别是在处理大型目录时:
# 设置文件I/O并行线程数(默认为CPU核心数和4之间的较小值)
# 对于高性能SSD,可以增加此值;对于机械硬盘,减小此值可能会更有效
export DIFFPATCH_IO_THREADS=2
diffpatch create --source ... --target ...
将生成的补丁文件放到需要更新的目录中,双击运行即可。补丁程序会先验证目录是否正确,然后利用并行处理快速应用文件更改。
cargo build --release
编译后的可执行文件将位于 target/release/ 目录中。