Skip to content

Commit 2bc94c0

Browse files
committed
dirdiff -> uniondiff
1 parent 01a4d20 commit 2bc94c0

25 files changed

+104
-104
lines changed

.dockerignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
*
2-
!dirdiff
2+
!uniondiff
33
!tests
44
!requirements*
55
!setup.cfg

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: dirdiff
1+
name: uniondiff
22
on:
33
push:
44
branches:

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ test-basic
66
.coverage
77
*.pypi-token.gpg
88
dist
9-
dirdiff.egg-info
9+
*.egg-info

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM python:3.8
22

3-
ENV PYTHONPATH=/dirdiff
4-
WORKDIR /dirdiff
3+
ENV PYTHONPATH=/uniondiff
4+
WORKDIR /uniondiff
55

66
COPY requirements* ./
77

Makefile

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ PYTHON ?= python3
33
PLATFORM ?= linux/amd64
44
PROFILE ?= dev
55
IMAGE_BUILDER ?= docker
6-
IMAGE_NAME ?= msg555/dirdiff
6+
IMAGE_NAME ?= msg555/uniondiff
77

88
all: format lint test docs
99

@@ -16,25 +16,25 @@ format-check:
1616
$(PYTHON) -m isort --profile=black --check .
1717

1818
pylint:
19-
$(PYTHON) -m pylint dirdiff tests
19+
$(PYTHON) -m pylint uniondiff tests
2020

2121
typecheck:
22-
$(PYTHON) -m mypy dirdiff tests
22+
$(PYTHON) -m mypy uniondiff tests
2323

2424
lint: format-check pylint typecheck
2525

2626
test:
2727
ifeq ($(OS),Windows_NT)
28-
$(PYTHON) -m pytest -sv --cov=dirdiff -m 'not cap and not unix' tests
28+
$(PYTHON) -m pytest -sv --cov=uniondiff -m 'not cap and not unix' tests
2929
else
30-
$(PYTHON) -m pytest -sv --cov=dirdiff -m 'not cap' tests
30+
$(PYTHON) -m pytest -sv --cov=uniondiff -m 'not cap' tests
3131
endif
3232

3333
test-all:
3434
ifeq ($(OS),Windows_NT)
35-
$(PYTHON) -m pytest -sv --cov=dirdiff -m 'not unix' tests
35+
$(PYTHON) -m pytest -sv --cov=uniondiff -m 'not unix' tests
3636
else
37-
$(PYTHON) -m pytest -sv --cov=dirdiff -m '' tests
37+
$(PYTHON) -m pytest -sv --cov=uniondiff -m '' tests
3838
endif
3939

4040
build:
@@ -47,7 +47,7 @@ image:
4747
$(IMAGE_BUILDER) build -t $(IMAGE_NAME) .
4848

4949
image-%: image
50-
docker run --rm -v "$${PWD}:/dirdiff" $(IMAGE_NAME) make $*
50+
docker run --rm -v "$${PWD}:/uniondiff" $(IMAGE_NAME) make $*
5151

5252
pypi-test: build
5353
TWINE_USERNAME=__token__ TWINE_PASSWORD="$(shell gpg -d test.pypi-token.gpg)" \

README.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
1-
# dirdiff - Directory difference calculator
1+
# uniondiff - Directory difference calculator
22

3-
*dirdiff* is a simple tool for calculating the directory difference between two
4-
directories or archives. Dirdiff performs the calculation below:
3+
*uniondiff* is a simple tool for calculating the directory difference between two
4+
directories or archives. *uniondiff* performs the calculation below:
55

66
```
77
upper = merged - lower
88
```
99

1010
This tool acts as the inverse [union mount](https://en.wikipedia.org/wiki/Union_mount)
1111
file systems. Whereas typically you combine a *lower* and *upper* directory to
12-
produce a *merged* directory, *dirdiff* takes as input the *merged* directory
12+
produce a *merged* directory, *uniondiff* takes as input the *merged* directory
1313
and subtracts out the *lower* directory to produce the *upper* directory. In
1414
particular, the resulting output can be mounted as the *upper* directory
1515
along with the *lower* to produce the original *merged* directory.
1616

17-
*dirdiff* is intended for use with low level file system tools (e.g. container
17+
*uniondiff* is intended for use with low level file system tools (e.g. container
1818
systems) or for simply storing diffs of directories. Note that this tool *does
1919
not* store compact diffs of individual files; a file will appear in full in the
2020
diff iff its content or metadata has changed between the *merged* and *lower*
2121
operands.
2222

2323
## Installation
2424

25-
*dirdiff* can be installed through *pip*. This installs both the `dirdiff`
26-
CLI utility and the *dirdiff* Python library.
25+
*uniondiff* can be installed through *pip*. This installs both the `uniondiff`
26+
CLI utility and the *uniondiff* Python library.
2727

2828
```sh
2929
pip install tplbuild
3030
```
3131

32-
*dirdiff* is supported and tested on Python 3.8-3.10
32+
*uniondiff* is supported and tested on Python 3.8-3.10
3333

3434
## Examples
3535

3636
Compute the directory difference between the directory "data-day10" and
3737
"data-day9". By default the output will be written as a tar file.
3838

3939
```sh
40-
dirdiff data-day10 data-day9 > diff.tar
40+
uniondiff data-day10 data-day9 > diff.tar
4141
```
4242

43-
Dirdiff can also write directly to the file system. Note that it will ignore
43+
*uniondiff* can also write directly to the file system. Note that it will ignore
4444
ownership changes unless you also pass the `--preserve-owners` flag.
4545

4646
```sh
47-
dirdiff data-day10 data-day9 --output-type file -o diff
47+
uniondiff data-day10 data-day9 --output-type file -o diff
4848
```
4949

5050
You can also use tar archives as the input paths.
5151

5252
```sh
53-
dirdiff data-day10.tar data-day9.tgz > diff.tar
53+
uniondiff data-day10.tar data-day9.tgz > diff.tar
5454
```
5555

5656
## Contributing
5757

58-
If you want to contribute to *dirdiff*, you can do so by creating a pull request.
58+
If you want to contribute to *uniondiff*, you can do so by creating a pull request.
5959
lease make sure to include a detailed description of the changes you're proposing.

setup.cfg

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[metadata]
2-
name = dirdiff
3-
version = attr: dirdiff._version.__version__
2+
name = uniondiff
3+
version = attr: uniondiff._version.__version__
44
author = Mark Gordon
55
author_email = [email protected]
66
description = Directory difference CLI tool
77
long_description = file: README.md
88
long_description_content_type = text/markdown
9-
url = http://github.com/msg555/dirdiff/
9+
url = http://github.com/msg555/uniondiff/
1010
classifiers =
1111
Programming Language :: Python
1212
Programming Language :: Python :: 3
@@ -18,14 +18,14 @@ classifiers =
1818

1919
[options]
2020
packages =
21-
dirdiff
21+
uniondiff
2222
python_requires = >=3.8
2323
include-package-data = True
2424

2525
[options.package_data]
26-
dirdiff =
26+
uniondiff =
2727
py.typed
2828

2929
[options.entry_points]
3030
console_scripts =
31-
dirdiff = dirdiff.cli:main
31+
uniondiff = uniondiff.cli:main

tests/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44

5-
from dirdiff.output_file import OutputBackendFile
5+
from uniondiff.output_file import OutputBackendFile
66

77

88
@pytest.fixture

tests/test_e2e.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import tarfile
44
import tempfile
55

6-
from dirdiff.cli import main
6+
from uniondiff.cli import main
77

88

99
def tar_summarize(tf: tarfile.TarFile):

tests/test_io_file.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
import pytest
66

7-
from dirdiff.filelib import DirectoryManager, StatInfo
8-
from dirdiff.osshim import major, makedev, minor
7+
from uniondiff.filelib import DirectoryManager, StatInfo
8+
from uniondiff.osshim import major, makedev, minor
99

1010
# pylint: disable=redefined-outer-name
1111

@@ -60,7 +60,7 @@ def test_file_write_dir(file_backend):
6060
def test_file_write_reg(file_backend):
6161
"""Test writing a regular file than reading the regular file"""
6262
mode = 0o644 | stat.S_IFREG
63-
data = b"Hello dirdiff!"
63+
data = b"Hello uniondiff!"
6464
file_name = "my-file"
6565

6666
st = stat_with_defaults(mode=mode, size=len(data))
@@ -83,7 +83,7 @@ def test_file_write_reg(file_backend):
8383
def test_file_write_link(file_backend):
8484
"""Test writing a file and a symlink pointing to it then reading the same"""
8585
mode = 0o644 | stat.S_IFREG
86-
data = b"Hello dirdiff!"
86+
data = b"Hello uniondiff!"
8787
file_name = "my-file"
8888

8989
st = stat_with_defaults(mode=mode, size=len(data))
@@ -155,7 +155,7 @@ def test_file_write_device(ftype, file_backend):
155155
def test_file_write_chown(file_backend_preserve):
156156
"""Test ownership preservation with a regular file"""
157157
mode = 0o644 | stat.S_IFREG
158-
data = b"Hello dirdiff!"
158+
data = b"Hello uniondiff!"
159159
file_name = "my-file"
160160
uid = 123
161161
gid = 543

tests/test_io_tar.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
import pytest
66

7-
from dirdiff.filelib import StatInfo
8-
from dirdiff.filelib_tar import TarDirectoryManager, TarFileLoader
9-
from dirdiff.osshim import major, makedev, minor, posix_join
10-
from dirdiff.output_tar import OutputBackendTarfile
7+
from uniondiff.filelib import StatInfo
8+
from uniondiff.filelib_tar import TarDirectoryManager, TarFileLoader
9+
from uniondiff.osshim import major, makedev, minor, posix_join
10+
from uniondiff.output_tar import OutputBackendTarfile
1111

1212
DEFAULT_UID = 1234
1313
DEFAULT_GID = 4567
@@ -57,7 +57,7 @@ def test_file_write_dir():
5757
def test_file_write_reg():
5858
"""Test writing a regular file than reading the regular file from archive"""
5959
mode = 0o644 | stat.S_IFREG
60-
file_data = b"Hello dirdiff!"
60+
file_data = b"Hello uniondiff!"
6161
file_name = "my-file"
6262
st = stat_with_defaults(mode=mode, size=len(file_data))
6363

@@ -92,7 +92,7 @@ def test_file_write_reg():
9292
def test_file_write_link():
9393
"""Test writing a file and a symlink pointing to it then reading the same from archive"""
9494
mode = 0o644 | stat.S_IFREG
95-
file_data = b"Hello dirdiff!"
95+
file_data = b"Hello uniondiff!"
9696
file_name = "my-file"
9797
st = stat_with_defaults(mode=mode, size=len(file_data))
9898

File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import logging
22
import sys
33

4-
from dirdiff.cli import main
5-
from dirdiff.exceptions import (
6-
DirDiffException,
7-
DirDiffInputException,
8-
DirDiffOutputException,
4+
from uniondiff.cli import main
5+
from uniondiff.exceptions import (
6+
UnionDiffException,
7+
UnionDiffInputException,
8+
UnionDiffOutputException,
99
)
1010

1111
LOGGER = logging.getLogger(__name__)
1212

1313
try:
1414
sys.exit(main())
15-
except DirDiffException as exc:
15+
except UnionDiffException as exc:
1616
LOGGER.error("%s", exc)
17-
if isinstance(exc, DirDiffInputException):
17+
if isinstance(exc, UnionDiffInputException):
1818
LOGGER.warning("use --input-best-effort to ignore this error")
19-
elif isinstance(exc, DirDiffOutputException):
19+
elif isinstance(exc, UnionDiffOutputException):
2020
LOGGER.warning("use --output-best-effort to ignore this error")
2121
sys.exit(exc.exit_code)
File renamed without changes.

dirdiff/cli.py renamed to uniondiff/cli.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
from contextlib import ExitStack
77
from typing import Union
88

9-
from dirdiff.differ import Differ, DifferOptions
10-
from dirdiff.exceptions import DirDiffException
11-
from dirdiff.output import DiffOutput, DiffOutputDryRun, OutputBackend
12-
from dirdiff.output_aufs import DiffOutputAufs
13-
from dirdiff.output_file import OutputBackendFile
14-
from dirdiff.output_overlay import DiffOutputOverlay
15-
from dirdiff.output_tar import OutputBackendTarfile
9+
from uniondiff.differ import Differ, DifferOptions
10+
from uniondiff.exceptions import UnionDiffException
11+
from uniondiff.output import DiffOutput, DiffOutputDryRun, OutputBackend
12+
from uniondiff.output_aufs import DiffOutputAufs
13+
from uniondiff.output_file import OutputBackendFile
14+
from uniondiff.output_overlay import DiffOutputOverlay
15+
from uniondiff.output_tar import OutputBackendTarfile
1616

1717
LOGGER = logging.getLogger(__name__)
1818

@@ -153,9 +153,9 @@ def _get_input_dir(
153153
try:
154154
return stack.enter_context(tarfile.open(path, mode="r"))
155155
except FileNotFoundError as exc:
156-
raise DirDiffException(f"Input path {repr(path)} does not exist") from exc
156+
raise UnionDiffException(f"Input path {repr(path)} does not exist") from exc
157157
except (OSError, tarfile.TarError) as exc:
158-
raise DirDiffException(
158+
raise UnionDiffException(
159159
f"Failed to open input file {repr(path)}: {exc}"
160160
) from exc
161161

@@ -170,7 +170,7 @@ def _get_backend(
170170
tf = stack.enter_context(tarfile.open(output, mode=tar_mode))
171171
else:
172172
if not force and sys.stdout.isatty():
173-
raise DirDiffException("Refusing to write tar file to terminal")
173+
raise UnionDiffException("Refusing to write tar file to terminal")
174174
tf = stack.enter_context(
175175
tarfile.open(mode=tar_mode, fileobj=sys.stdout.buffer)
176176
)
@@ -181,12 +181,12 @@ def _get_backend(
181181
assert output_type == "file"
182182

183183
if not output:
184-
raise DirDiffException(
184+
raise UnionDiffException(
185185
"--output file path must be provided with 'file' output type"
186186
)
187187

188188
if not force and os.path.exists(output):
189-
raise DirDiffException("output path already exists")
189+
raise UnionDiffException("output path already exists")
190190

191191
os.umask(0)
192192
return OutputBackendFile(output, preserve_owners=preserve_owners)

0 commit comments

Comments
 (0)