diff options
-rw-r--r-- | subcmds/sync.py | 4 | ||||
-rw-r--r-- | subcmds/upload.py | 7 | ||||
-rw-r--r-- | tests/test_subcmds_sync.py | 4 |
3 files changed, 11 insertions, 4 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index bbe03722..159771eb 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -1696,7 +1696,7 @@ later is required to fix a server side protocol bug. | |||
1696 | ) | 1696 | ) |
1697 | 1697 | ||
1698 | self._fetch_times = _FetchTimes(manifest) | 1698 | self._fetch_times = _FetchTimes(manifest) |
1699 | self._local_sync_state = _LocalSyncState(manifest) | 1699 | self._local_sync_state = LocalSyncState(manifest) |
1700 | if not opt.local_only: | 1700 | if not opt.local_only: |
1701 | with multiprocessing.Manager() as manager: | 1701 | with multiprocessing.Manager() as manager: |
1702 | with ssh.ProxyManager(manager) as ssh_proxy: | 1702 | with ssh.ProxyManager(manager) as ssh_proxy: |
@@ -1932,7 +1932,7 @@ class _FetchTimes(object): | |||
1932 | platform_utils.remove(self._path, missing_ok=True) | 1932 | platform_utils.remove(self._path, missing_ok=True) |
1933 | 1933 | ||
1934 | 1934 | ||
1935 | class _LocalSyncState(object): | 1935 | class LocalSyncState(object): |
1936 | _LAST_FETCH = "last_fetch" | 1936 | _LAST_FETCH = "last_fetch" |
1937 | _LAST_CHECKOUT = "last_checkout" | 1937 | _LAST_CHECKOUT = "last_checkout" |
1938 | 1938 | ||
diff --git a/subcmds/upload.py b/subcmds/upload.py index 040eaeb5..b89525ce 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py | |||
@@ -26,6 +26,7 @@ from git_command import GitCommand | |||
26 | from git_refs import R_HEADS | 26 | from git_refs import R_HEADS |
27 | from hooks import RepoHook | 27 | from hooks import RepoHook |
28 | from project import ReviewableBranch | 28 | from project import ReviewableBranch |
29 | from subcmds.sync import LocalSyncState | ||
29 | 30 | ||
30 | 31 | ||
31 | _DEFAULT_UNUSUAL_COMMIT_THRESHOLD = 5 | 32 | _DEFAULT_UNUSUAL_COMMIT_THRESHOLD = 5 |
@@ -804,6 +805,12 @@ Gerrit Code Review: https://www.gerritcodereview.com/ | |||
804 | if not hook.Run( | 805 | if not hook.Run( |
805 | project_list=pending_proj_names, worktree_list=pending_worktrees | 806 | project_list=pending_proj_names, worktree_list=pending_worktrees |
806 | ): | 807 | ): |
808 | if LocalSyncState(manifest).IsPartiallySynced(): | ||
809 | print( | ||
810 | "Partially synced tree detected. Syncing all projects " | ||
811 | "may resolve issues you're seeing.", | ||
812 | file=sys.stderr, | ||
813 | ) | ||
807 | ret = 1 | 814 | ret = 1 |
808 | if ret: | 815 | if ret: |
809 | return ret | 816 | return ret |
diff --git a/tests/test_subcmds_sync.py b/tests/test_subcmds_sync.py index b43fe18e..71b0f8e0 100644 --- a/tests/test_subcmds_sync.py +++ b/tests/test_subcmds_sync.py | |||
@@ -110,7 +110,7 @@ def test_cli_jobs(argv, jobs_manifest, jobs, jobs_net, jobs_check): | |||
110 | 110 | ||
111 | 111 | ||
112 | class LocalSyncState(unittest.TestCase): | 112 | class LocalSyncState(unittest.TestCase): |
113 | """Tests for _LocalSyncState.""" | 113 | """Tests for LocalSyncState.""" |
114 | 114 | ||
115 | _TIME = 10 | 115 | _TIME = 10 |
116 | 116 | ||
@@ -129,7 +129,7 @@ class LocalSyncState(unittest.TestCase): | |||
129 | 129 | ||
130 | def _new_state(self, time=_TIME): | 130 | def _new_state(self, time=_TIME): |
131 | with mock.patch("time.time", return_value=time): | 131 | with mock.patch("time.time", return_value=time): |
132 | return sync._LocalSyncState(self.manifest) | 132 | return sync.LocalSyncState(self.manifest) |
133 | 133 | ||
134 | def test_set(self): | 134 | def test_set(self): |
135 | """Times are set.""" | 135 | """Times are set.""" |