|
1 |
| -WIP |
| 1 | +# dirdiff - Directory difference calculator |
2 | 2 |
|
3 |
| -CLI utility to compute the diff between two directories. |
| 3 | +*dirdiff* is a simple tool for calculating the directory difference between two |
| 4 | +directories or archives. Dirdiff performs the calculation below: |
4 | 5 |
|
5 |
| -The initially supported output format will be overlayfs tar or direct file |
6 |
| -output. These output will be such that they can be used as the upper layer in an |
7 |
| -overlayfs mount alongside the left operand of the diff to produce the same |
8 |
| -contents present in the right operand as the merged mount. |
| 6 | +``` |
| 7 | +upper = merged - lower |
| 8 | +``` |
9 | 9 |
|
10 |
| -This tool is intended to be used by systems directly managing container image |
11 |
| -contents. |
| 10 | +This tool acts as the inverse [union mount](https://en.wikipedia.org/wiki/Union_mount) |
| 11 | +file systems. Whereas typically you combine a *lower* and *upper* directory to |
| 12 | +produce a *merged* directory, *dirdiff* takes as input the *merged* directory |
| 13 | +and subtracts out the *lower* directory to produce the *upper* directory. In |
| 14 | +particular, the resulting output can be mounted as the *upper* directory |
| 15 | +along with the *lower* to produce the original *merged* directory. |
| 16 | + |
| 17 | +*dirdiff* is intended for use with low level file system tools (e.g. container |
| 18 | +systems) or for simply storing diffs of directories. Note that this tool *does |
| 19 | +not* store compact diffs of individual files; a file will appear in full in the |
| 20 | +diff iff its content or metadata has changed between the *merged* and *lower* |
| 21 | +operands. |
| 22 | + |
| 23 | +## Installation |
| 24 | + |
| 25 | +*dirdiff* can be installed through *pip*. This installs both the `dirdiff` |
| 26 | +CLI utility and the *dirdiff* Python library. |
| 27 | + |
| 28 | +```sh |
| 29 | +pip install tplbuild |
| 30 | +``` |
| 31 | + |
| 32 | +*dirdiff* is supported and tested on Python 3.8-3.10 |
| 33 | + |
| 34 | +## Examples |
| 35 | + |
| 36 | +Compute the directory difference between the directory "data-day10" and |
| 37 | +"data-day9". By default the output will be written as a tar file. |
| 38 | + |
| 39 | +```sh |
| 40 | +dirdiff data-day10 data-day9 > diff.tar |
| 41 | +``` |
| 42 | + |
| 43 | +Dirdiff can also write directly to the file system. Note that it will ignore |
| 44 | +ownership changes unless you also pass the `--preserve-owners` flag. |
| 45 | + |
| 46 | +```sh |
| 47 | +dirdiff data-day10 data-day9 --output-type file -o diff |
| 48 | +``` |
| 49 | + |
| 50 | +You can also use tar archives as the input paths. |
| 51 | + |
| 52 | +```sh |
| 53 | +dirdiff data-day10.tar data-day9.tgz > diff.tar |
| 54 | +``` |
| 55 | + |
| 56 | +## Contributing |
| 57 | + |
| 58 | +If you want to contribute to *dirdiff*, you can do so by creating a pull request. |
| 59 | +lease make sure to include a detailed description of the changes you're proposing. |
0 commit comments