mirror of
https://github.com/facebook/sapling.git
synced 2024-12-26 14:34:34 +03:00
commitcloud: require visibleheads for sync
Summary: Commit cloud sync works best when visibleheads are enabled. Default to requiring it. Reviewed By: quark-zju Differential Revision: D22089414 fbshipit-source-id: b786103d5c5f65a7908eb97a973af9eca5990b22
This commit is contained in:
parent
a06ea2f1a6
commit
2eb20def5a
@ -13,6 +13,7 @@ import time
|
||||
from edenscm.mercurial import (
|
||||
blackbox,
|
||||
bookmarks,
|
||||
error,
|
||||
exchange,
|
||||
extensions,
|
||||
hg,
|
||||
@ -183,6 +184,18 @@ def _sync(
|
||||
repo, state, remotepath, getconnection, backupsnapshots=backupsnapshots
|
||||
)
|
||||
|
||||
# Now that commits are backed up, check that visibleheads are enabled
|
||||
# locally, and only sync if visibleheads is enabled.
|
||||
# developer config: commitcloud.requirevisibleheads
|
||||
if repo.ui.configbool("commitcloud", "requirevisibleheads", True):
|
||||
if not visibility.enabled(repo):
|
||||
hint = None
|
||||
if repo.ui.config("visibility", "automigrate") == "start":
|
||||
hint = "try 'hg pull' in this repo to trigger an upgrade"
|
||||
raise error.Abort(
|
||||
"commit cloud sync requires new-style visibility", hint=hint
|
||||
)
|
||||
|
||||
# On cloud rejoin we already know what the cloudrefs are. Otherwise,
|
||||
# fetch them from the commit cloud service.
|
||||
if cloudrefs is None:
|
||||
|
@ -5,7 +5,7 @@
|
||||
$ enable amend commitcloud infinitepush rebase remotenames share smartlog
|
||||
|
||||
$ setconfig infinitepush.branchpattern="re:scratch/.*"
|
||||
$ setconfig commitcloud.hostname=testhost
|
||||
$ setconfig commitcloud.hostname=testhost commitcloud.requirevisibleheads=false
|
||||
$ setconfig remotefilelog.reponame=server
|
||||
|
||||
$ hg init server
|
||||
|
@ -1,6 +1,6 @@
|
||||
#chg-compatible
|
||||
|
||||
$ configure dummyssh evolution
|
||||
$ configure dummyssh mutation-norecord
|
||||
$ disable treemanifest
|
||||
$ enable amend directaccess commitcloud infinitepush rebase remotenames share smartlog
|
||||
|
||||
@ -189,6 +189,12 @@ Make a commit in the first client, and sync it
|
||||
finished in * (glob)
|
||||
remote: pushing 1 commit:
|
||||
remote: fa5d62c46fd7 commit1
|
||||
|
||||
Sync requires visibility
|
||||
$ hg cloud sync --config visibility.enabled=false
|
||||
commitcloud: synchronizing 'server' with 'user/test/default'
|
||||
abort: commit cloud sync requires new-style visibility
|
||||
[255]
|
||||
$ cd ..
|
||||
|
||||
Sync from the second client - the commit should appear
|
||||
@ -818,7 +824,7 @@ Simulate failure to backup a commit by setting the server maxbundlesize limit ve
|
||||
remote: 715c1454ae33 stack commit 2
|
||||
remote: a6b97eebbf74 shared commit updated
|
||||
remote: 9bd68ef10d6b toobig
|
||||
push failed: bundle is too big: 2219 bytes. max allowed size is 0 MB
|
||||
push failed: bundle is too big: 2460 bytes. max allowed size is 0 MB
|
||||
retrying push with discovery
|
||||
searching for changes
|
||||
remote: pushing 4 commits:
|
||||
@ -826,32 +832,32 @@ Simulate failure to backup a commit by setting the server maxbundlesize limit ve
|
||||
remote: 715c1454ae33 stack commit 2
|
||||
remote: a6b97eebbf74 shared commit updated
|
||||
remote: 9bd68ef10d6b toobig
|
||||
push of stack 4b4f26511f8b failed: bundle is too big: 2219 bytes. max allowed size is 0 MB
|
||||
push of stack 4b4f26511f8b failed: bundle is too big: 2460 bytes. max allowed size is 0 MB
|
||||
retrying each head individually
|
||||
remote: pushing 3 commits:
|
||||
remote: 4b4f26511f8b race attempt
|
||||
remote: 715c1454ae33 stack commit 2
|
||||
remote: a6b97eebbf74 shared commit updated
|
||||
push failed: bundle is too big: 1738 bytes. max allowed size is 0 MB
|
||||
push failed: bundle is too big: 1979 bytes. max allowed size is 0 MB
|
||||
retrying push with discovery
|
||||
searching for changes
|
||||
remote: pushing 3 commits:
|
||||
remote: 4b4f26511f8b race attempt
|
||||
remote: 715c1454ae33 stack commit 2
|
||||
remote: a6b97eebbf74 shared commit updated
|
||||
push of head a6b97eebbf74 failed: bundle is too big: 1738 bytes. max allowed size is 0 MB
|
||||
push of head a6b97eebbf74 failed: bundle is too big: 1979 bytes. max allowed size is 0 MB
|
||||
remote: pushing 3 commits:
|
||||
remote: 4b4f26511f8b race attempt
|
||||
remote: 715c1454ae33 stack commit 2
|
||||
remote: 9bd68ef10d6b toobig
|
||||
push failed: bundle is too big: 1695 bytes. max allowed size is 0 MB
|
||||
push failed: bundle is too big: 1869 bytes. max allowed size is 0 MB
|
||||
retrying push with discovery
|
||||
searching for changes
|
||||
remote: pushing 3 commits:
|
||||
remote: 4b4f26511f8b race attempt
|
||||
remote: 715c1454ae33 stack commit 2
|
||||
remote: 9bd68ef10d6b toobig
|
||||
push of head 9bd68ef10d6b failed: bundle is too big: 1695 bytes. max allowed size is 0 MB
|
||||
push of head 9bd68ef10d6b failed: bundle is too big: 1869 bytes. max allowed size is 0 MB
|
||||
commitcloud: failed to synchronize 2 commits
|
||||
finished in * (glob)
|
||||
|
||||
|
@ -242,127 +242,3 @@ It should also have mutations made on both sides visible.
|
||||
|
|
||||
o 0: d20a80d4def3 'base'
|
||||
|
||||
Introduce a third client that is still using obsmarker-based mutation and visibility
|
||||
(This is incompatible with narrow-heads)
|
||||
|
||||
$ cd $TESTTMP
|
||||
$ hg clone ssh://user@dummy/server client3 -q --config visibility.enabled=false
|
||||
$ cd client3
|
||||
$ setconfig commitcloud.servicetype=local commitcloud.servicelocation=$TESTTMP
|
||||
$ setconfig commitcloud.user_token_path=$TESTTMP
|
||||
$ setconfig mutation.enabled=false
|
||||
$ setconfig visibility.enabled=false
|
||||
$ setconfig experimental.narrow-heads=false
|
||||
$ hg cloud auth -t xxxxxx
|
||||
updating authentication token
|
||||
authentication successful
|
||||
$ hg cloud join
|
||||
commitcloud: this repository is now connected to the 'user/test/default' workspace for the 'server' repo
|
||||
commitcloud: synchronizing 'server' with 'user/test/default'
|
||||
pulling d8fc5ae9b7ef dd114d9b2f9e ba83c5428cb2 6caded0e9807 from ssh://user@dummy/server
|
||||
searching for changes
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 2 changesets with 2 changes to 2 files
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 2 changesets with 2 changes to 3 files
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 1 changesets with 0 changes to 3 files
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 1 changesets with 1 changes to 2 files
|
||||
commitcloud: commits synchronized
|
||||
finished in * sec (glob)
|
||||
$ tglogm
|
||||
o 6: dd114d9b2f9e 'X'
|
||||
|
|
||||
| o 5: d8fc5ae9b7ef 'D'
|
||||
| |
|
||||
| | o 4: ba83c5428cb2 'F'
|
||||
| |/
|
||||
| o 3: c70a9bd6bfd1 'E'
|
||||
|/
|
||||
| o 2: 6caded0e9807 'D'
|
||||
|/
|
||||
o 1: dae3b312bb78 'Z'
|
||||
|
|
||||
@ 0: d20a80d4def3 'base'
|
||||
|
||||
$ cd ../client1
|
||||
$ hg up $F
|
||||
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
updated to "ba83c5428cb2: F"
|
||||
3 other heads for branch "default"
|
||||
$ hg amend -m F-amended
|
||||
$ hg amend -m F-amended-again
|
||||
$ hg cloud sync
|
||||
commitcloud: synchronizing 'server' with 'user/test/default'
|
||||
backing up stack rooted at dae3b312bb78
|
||||
commitcloud: commits synchronized
|
||||
finished in * sec (glob)
|
||||
remote: pushing 3 commits:
|
||||
remote: dae3b312bb78 Z
|
||||
remote: c70a9bd6bfd1 E
|
||||
remote: b5ea82a7973c F-amended-again
|
||||
$ hg undo
|
||||
undone to *, before amend -m F-amended-again (glob)
|
||||
$ hg cloud sync
|
||||
commitcloud: synchronizing 'server' with 'user/test/default'
|
||||
backing up stack rooted at dae3b312bb78
|
||||
commitcloud: commits synchronized
|
||||
finished in * sec (glob)
|
||||
commitcloud: current revision 1ef69cfd595b has been replaced remotely with multiple revisions
|
||||
(run 'hg update HASH' to go to the desired revision)
|
||||
remote: pushing 3 commits:
|
||||
remote: dae3b312bb78 Z
|
||||
remote: c70a9bd6bfd1 E
|
||||
remote: 1ef69cfd595b F-amended
|
||||
|
||||
$ cd ../client3
|
||||
$ hg cloud sync
|
||||
commitcloud: synchronizing 'server' with 'user/test/default'
|
||||
pulling 1ef69cfd595b from ssh://user@dummy/server
|
||||
searching for changes
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 1 changesets with 0 changes to 3 files
|
||||
commitcloud: commits synchronized
|
||||
finished in * sec (glob)
|
||||
|
||||
$ cd ../client1
|
||||
$ hg cloud sync
|
||||
commitcloud: synchronizing 'server' with 'user/test/default'
|
||||
commitcloud: commits synchronized
|
||||
finished in * sec (glob)
|
||||
commitcloud: current revision 1ef69cfd595b has been replaced remotely with multiple revisions
|
||||
(run 'hg update HASH' to go to the desired revision)
|
||||
|
||||
$ cd ../client3
|
||||
$ hg cloud sync
|
||||
commitcloud: synchronizing 'server' with 'user/test/default'
|
||||
commitcloud: commits synchronized
|
||||
finished in * sec (glob)
|
||||
$ tglogm
|
||||
o 7: 1ef69cfd595b 'F-amended'
|
||||
|
|
||||
| o 6: dd114d9b2f9e 'X'
|
||||
| |
|
||||
+---o 5: d8fc5ae9b7ef 'D'
|
||||
| |
|
||||
+---o 4: ba83c5428cb2 'F'
|
||||
| |
|
||||
o | 3: c70a9bd6bfd1 'E'
|
||||
|/
|
||||
| o 2: 6caded0e9807 'D'
|
||||
|/
|
||||
o 1: dae3b312bb78 'Z'
|
||||
|
|
||||
@ 0: d20a80d4def3 'base'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user