path-sync 0.2.0__py3-none-any.whl → 0.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- path_sync/cmd_copy.py +3 -2
- path_sync/cmd_copy_test.py +21 -0
- {path_sync-0.2.0.dist-info → path_sync-0.2.1.dist-info}/METADATA +1 -1
- {path_sync-0.2.0.dist-info → path_sync-0.2.1.dist-info}/RECORD +6 -6
- {path_sync-0.2.0.dist-info → path_sync-0.2.1.dist-info}/WHEEL +0 -0
- {path_sync-0.2.0.dist-info → path_sync-0.2.1.dist-info}/entry_points.txt +0 -0
path_sync/cmd_copy.py
CHANGED
|
@@ -391,10 +391,11 @@ def _copy_with_header(
|
|
|
391
391
|
|
|
392
392
|
if dest_path.exists():
|
|
393
393
|
existing = dest_path.read_text()
|
|
394
|
-
|
|
394
|
+
has_header = header.has_header(existing)
|
|
395
|
+
if not has_header and not force_overwrite:
|
|
395
396
|
logger.info(f"Skipping {dest_path} (header removed - opted out)")
|
|
396
397
|
return 0
|
|
397
|
-
if header.remove_header(existing) == src_content:
|
|
398
|
+
if header.remove_header(existing) == src_content and has_header:
|
|
398
399
|
return 0
|
|
399
400
|
|
|
400
401
|
new_content = header.add_header(src_content, dest_path.suffix, config_name)
|
path_sync/cmd_copy_test.py
CHANGED
|
@@ -55,6 +55,27 @@ def test_sync_skips_opted_out_file(tmp_path):
|
|
|
55
55
|
assert (dest_root / "file.py").read_text() == "local content without header"
|
|
56
56
|
|
|
57
57
|
|
|
58
|
+
def test_force_overwrite_adds_header_when_content_matches(tmp_path):
|
|
59
|
+
src_root = tmp_path / "src"
|
|
60
|
+
dest_root = tmp_path / "dest"
|
|
61
|
+
src_root.mkdir()
|
|
62
|
+
dest_root.mkdir()
|
|
63
|
+
|
|
64
|
+
content = "same content"
|
|
65
|
+
(src_root / "file.py").write_text(content)
|
|
66
|
+
(dest_root / "file.py").write_text(content) # No header, same content
|
|
67
|
+
|
|
68
|
+
mapping = PathMapping(src_path="file.py")
|
|
69
|
+
changes, _ = _sync_path(
|
|
70
|
+
mapping, src_root, dest_root, _make_dest(), CONFIG_NAME, False, True
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
assert changes == 1
|
|
74
|
+
result = (dest_root / "file.py").read_text()
|
|
75
|
+
assert has_header(result)
|
|
76
|
+
assert content in result
|
|
77
|
+
|
|
78
|
+
|
|
58
79
|
def test_cleanup_orphans(tmp_path):
|
|
59
80
|
dest_root = tmp_path / "dest"
|
|
60
81
|
dest_root.mkdir()
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
path_sync/__init__.py,sha256=fdUhqFKjflvMkVbUuA_RMMv4am652KWK8N3IVQzj6ok,63
|
|
2
2
|
path_sync/__main__.py,sha256=Hh0Na0BlS0EwBAerhWD4mnaB-oMo6jufFVQBuzNZk3g,296
|
|
3
3
|
path_sync/cmd_boot.py,sha256=hYSrMF9QHVXX5feO2UE3lFSJvV38tEsJaNl0sjU2gbw,2896
|
|
4
|
-
path_sync/cmd_copy.py,sha256=
|
|
5
|
-
path_sync/cmd_copy_test.py,sha256=
|
|
4
|
+
path_sync/cmd_copy.py,sha256=RcIv3s6HDiOHU3Z1Q5HYzVIOGDc_4cYqYGyj9Gpnjlk,15701
|
|
5
|
+
path_sync/cmd_copy_test.py,sha256=dcpRaFAmXuUavIvtA59_In4Fa58FKRklNcYmeGsEuVA,5049
|
|
6
6
|
path_sync/cmd_validate.py,sha256=wcMo_JR2jxFtqaNQt1mk_Mnwy_jPSpFHCXFuzNOphEU,1624
|
|
7
7
|
path_sync/conftest.py,sha256=-iu7W2Bh2aRzTR1x3aMnkWkrVnDMp6ezdh1AFgNcYUE,343
|
|
8
8
|
path_sync/file_utils.py,sha256=5C33qzKFQdwChi5YwUWBujj126t0P6dbGSU_5hWExpE,194
|
|
@@ -17,7 +17,7 @@ path_sync/typer_app.py,sha256=lEGMRXql3Se3VbmwAohvpUaL2cbY-RwhPUq8kL7bPbc,177
|
|
|
17
17
|
path_sync/validation.py,sha256=RP9SWd69mGvB4MxGx4RFJiyIQ-X482Y5h7G7VYAOxiE,2766
|
|
18
18
|
path_sync/validation_test.py,sha256=NdK1JHAtjGIm7m7uVm0fM751ttJhKXrS21gt1eEDhP0,3071
|
|
19
19
|
path_sync/yaml_utils.py,sha256=yj6Bl54EltjLEcVKaiA5Ahb9byT6OUMh0xIEzTsrvnQ,498
|
|
20
|
-
path_sync-0.2.
|
|
21
|
-
path_sync-0.2.
|
|
22
|
-
path_sync-0.2.
|
|
23
|
-
path_sync-0.2.
|
|
20
|
+
path_sync-0.2.1.dist-info/METADATA,sha256=4-DnsGErtoA24qkvnBMXK4HuKm7YR-ZhX4FZ5h2zXXQ,7785
|
|
21
|
+
path_sync-0.2.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
22
|
+
path_sync-0.2.1.dist-info/entry_points.txt,sha256=jTsL0c-9gP-4_Jt3EPgihtpLcwQR0AFAf1AUpD50AlI,54
|
|
23
|
+
path_sync-0.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|