mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
commitcloud: use metalog root to test repo changes
Summary:
This works more reliably and fully restores `test-commitcloud-sync-race.t` to
pre-D28595292 (c72cd2333f
) state.
Reviewed By: markbt
Differential Revision: D30974286
fbshipit-source-id: 729e20f23cb5d8aacdbcef1c869fc9a73ac4d4d4
This commit is contained in:
parent
2a9fc4819a
commit
e97d83b447
@ -200,8 +200,7 @@ def _sync(
|
||||
# The line below makes sure that working copy is updated.
|
||||
return _maybeupdateworkingcopy(repo, startnode), None
|
||||
|
||||
origheads = _getheads(repo)
|
||||
origbookmarks = _getbookmarks(repo)
|
||||
origmlroot = repo.metalog().root()
|
||||
|
||||
remotepath = ccutil.getremotepath(ui)
|
||||
|
||||
@ -246,14 +245,6 @@ def _sync(
|
||||
{("treemanifest", "prefetchdraftparents"): False}, "cloudsync"
|
||||
), repo.wlock(), repo.lock():
|
||||
|
||||
if origheads != _getheads(repo) or origbookmarks != _getbookmarks(repo):
|
||||
# Another transaction changed the repository while we were backing
|
||||
# up commits. This may have introduced new commits that also need
|
||||
# backing up. That transaction should have started its own sync
|
||||
# process, so give up on this sync, and let the later one perform
|
||||
# the sync.
|
||||
raise ccerror.SynchronizationError(ui, _("repo changed while backing up"))
|
||||
|
||||
synced = False
|
||||
attempt = 0
|
||||
while not synced:
|
||||
@ -266,6 +257,16 @@ def _sync(
|
||||
|
||||
with repo.transaction("cloudsync") as tr:
|
||||
|
||||
if repo.metalog().root() != origmlroot:
|
||||
# Another transaction changed the repository while we were backing
|
||||
# up commits. This may have introduced new commits that also need
|
||||
# backing up. That transaction should have started its own sync
|
||||
# process, so give up on this sync, and let the later one perform
|
||||
# the sync.
|
||||
raise ccerror.SynchronizationError(
|
||||
ui, _("repo changed while backing up")
|
||||
)
|
||||
|
||||
# Apply any changes from the cloud to the local repo.
|
||||
if cloudrefs.version != fetchversion:
|
||||
_applycloudchanges(
|
||||
|
@ -124,4 +124,6 @@ Wait for the background backup to finish and check its output.
|
||||
$ cat $TESTTMP/bgsync.out
|
||||
commitcloud: synchronizing 'testrepo' with 'user/test/default'
|
||||
visibility: read 0 heads:
|
||||
abort: unknown revision '1292cc1f1c1783567cebc137763d8fcf042370c6'!
|
||||
abort: commitcloud: failed to synchronize commits: 'repo changed while backing up'
|
||||
(please retry 'hg cloud sync')
|
||||
(please contact the Source Control Team if this error persists)
|
||||
|
@ -905,7 +905,7 @@ Run cloud status after failing to synchronize
|
||||
Raw Workspace Name: user/test/default
|
||||
Automatic Sync (on local changes): OFF
|
||||
Automatic Sync via 'Scm Daemon' (on remote changes): OFF
|
||||
Last Sync Version: 18
|
||||
Last Sync Version: 17
|
||||
Last Sync Heads: 1 (0 omitted)
|
||||
Last Sync Bookmarks: 1 (0 omitted)
|
||||
Last Sync Remote Bookmarks: 0
|
||||
|
Loading…
Reference in New Issue
Block a user