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. ) self._fetch_times = _FetchTimes(manifest) - self._local_sync_state = _LocalSyncState(manifest) + self._local_sync_state = LocalSyncState(manifest) if not opt.local_only: with multiprocessing.Manager() as manager: with ssh.ProxyManager(manager) as ssh_proxy: @@ -1932,7 +1932,7 @@ class _FetchTimes(object): platform_utils.remove(self._path, missing_ok=True) -class _LocalSyncState(object): +class LocalSyncState(object): _LAST_FETCH = "last_fetch" _LAST_CHECKOUT = "last_checkout" 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 from git_refs import R_HEADS from hooks import RepoHook from project import ReviewableBranch +from subcmds.sync import LocalSyncState _DEFAULT_UNUSUAL_COMMIT_THRESHOLD = 5 @@ -804,6 +805,12 @@ Gerrit Code Review: https://www.gerritcodereview.com/ if not hook.Run( project_list=pending_proj_names, worktree_list=pending_worktrees ): + if LocalSyncState(manifest).IsPartiallySynced(): + print( + "Partially synced tree detected. Syncing all projects " + "may resolve issues you're seeing.", + file=sys.stderr, + ) ret = 1 if ret: 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): class LocalSyncState(unittest.TestCase): - """Tests for _LocalSyncState.""" + """Tests for LocalSyncState.""" _TIME = 10 @@ -129,7 +129,7 @@ class LocalSyncState(unittest.TestCase): def _new_state(self, time=_TIME): with mock.patch("time.time", return_value=time): - return sync._LocalSyncState(self.manifest) + return sync.LocalSyncState(self.manifest) def test_set(self): """Times are set."""