dbx-sync 0.2.0__tar.gz → 0.3.0__tar.gz
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.
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/PKG-INFO +1 -1
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/src/dbx_sync/__init__.py +1 -1
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/src/dbx_sync/sync.py +14 -0
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/tests/test_sync.py +24 -0
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/.github/CODEOWNERS +0 -0
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/.github/workflows/release.yml +0 -0
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/.gitignore +0 -0
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/.python-version +0 -0
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/AGENTS.md +0 -0
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/CONTRIBUTING.md +0 -0
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/LICENSE +0 -0
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/README.md +0 -0
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/pyproject.toml +0 -0
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/src/dbx_sync/__main__.py +0 -0
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/src/dbx_sync/cli.py +0 -0
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/tests/test_cli.py +0 -0
- {dbx_sync-0.2.0 → dbx_sync-0.3.0}/uv.lock +0 -0
|
@@ -621,6 +621,20 @@ def run_forever(config: dict[str, Any], config_path: Path, dry_run: bool) -> int
|
|
|
621
621
|
result["removed"],
|
|
622
622
|
result["skipped"],
|
|
623
623
|
)
|
|
624
|
+
if result["conflicts"] > 0:
|
|
625
|
+
conflicted_paths = [
|
|
626
|
+
path
|
|
627
|
+
for path, state in config.get("files", {}).items()
|
|
628
|
+
if state.get("last_action") == "conflict"
|
|
629
|
+
]
|
|
630
|
+
LOGGER.error(
|
|
631
|
+
"Stopping watch mode: %d conflict(s) detected. "
|
|
632
|
+
"Conflicting file(s): %s. "
|
|
633
|
+
"Run with --force to clear sync state and retry.",
|
|
634
|
+
result["conflicts"],
|
|
635
|
+
", ".join(conflicted_paths),
|
|
636
|
+
)
|
|
637
|
+
return 1
|
|
624
638
|
|
|
625
639
|
time.sleep(int(config["poll_interval_seconds"]))
|
|
626
640
|
except KeyboardInterrupt:
|
|
@@ -804,6 +804,30 @@ def test_run_forever_retries_after_sync_pass_failure(
|
|
|
804
804
|
assert mock_sleep.call_count == 2
|
|
805
805
|
|
|
806
806
|
|
|
807
|
+
@patch("dbx_sync.sync.time.sleep", side_effect=KeyboardInterrupt)
|
|
808
|
+
@patch(
|
|
809
|
+
"dbx_sync.sync.run_sync_pass",
|
|
810
|
+
return_value={"downloaded": 0, "uploaded": 0, "conflicts": 1, "removed": 0, "skipped": 0},
|
|
811
|
+
)
|
|
812
|
+
def test_run_forever_exits_on_conflict(
|
|
813
|
+
mock_run_sync_pass: MagicMock, mock_sleep: MagicMock, tmp_path: Path
|
|
814
|
+
) -> None:
|
|
815
|
+
config = {
|
|
816
|
+
"local_dir": str(tmp_path),
|
|
817
|
+
"remote_path": "/workspace",
|
|
818
|
+
"poll_interval_seconds": 1,
|
|
819
|
+
"files": {
|
|
820
|
+
"/workspace/nb": {**sync._default_file_state(), "last_action": "conflict"},
|
|
821
|
+
},
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
result = sync.run_forever(config, tmp_path / "config.json", dry_run=False)
|
|
825
|
+
|
|
826
|
+
assert result == 1
|
|
827
|
+
mock_run_sync_pass.assert_called_once()
|
|
828
|
+
mock_sleep.assert_not_called()
|
|
829
|
+
|
|
830
|
+
|
|
807
831
|
@patch(
|
|
808
832
|
"dbx_sync.sync.run_sync_pass",
|
|
809
833
|
return_value={"downloaded": 0, "uploaded": 0, "conflicts": 0, "removed": 0, "skipped": 0},
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|