From 1afe96a7e997ce7748f066b206a85ac648f7a87c Mon Sep 17 00:00:00 2001 From: Gavin Mak Date: Mon, 20 Oct 2025 11:13:09 -0700 Subject: sync: fix saving of fetch times and local state Interleaved sync didn't save _fetch_times and _local_sync_state to disk. Phased sync saved them, but incorrectly applied moving average smoothing repeatedly when fetching submodules, and discarded historical data during partial syncs. Move .Save() calls to the end of main sync loops to ensure they run once. Update _FetchTimes.Save() to merge new data with existing history, preventing data loss. Change-Id: I174f98a62ac86859f1eeea1daba65eb35c227852 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/519821 Commit-Queue: Gavin Mak Reviewed-by: Scott Lee Tested-by: Gavin Mak --- tests/test_subcmds_sync.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/test_subcmds_sync.py') diff --git a/tests/test_subcmds_sync.py b/tests/test_subcmds_sync.py index 6c9cc9ab..6eb8a5a7 100644 --- a/tests/test_subcmds_sync.py +++ b/tests/test_subcmds_sync.py @@ -681,6 +681,9 @@ class InterleavedSyncTest(unittest.TestCase): # Mock _GetCurrentBranchOnly for worker tests. mock.patch.object(sync.Sync, "_GetCurrentBranchOnly").start() + self.cmd._fetch_times = mock.Mock() + self.cmd._local_sync_state = mock.Mock() + def tearDown(self): """Clean up resources.""" shutil.rmtree(self.repodir) -- cgit v1.2.3-54-g00ecf