sapling/eden/scm/tests/test-visibility-cloudsync.t
Mark Thomas 2eb20def5a 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
2020-06-18 12:15:00 -07:00

245 lines
6.3 KiB
Perl

#chg-compatible
$ configure dummyssh
$ disable treemanifest
$ enable amend directaccess commitcloud infinitepush rebase remotenames undo
$ setconfig infinitepush.branchpattern="re:scratch/.*"
$ setconfig commitcloud.hostname=testhost
$ setconfig visibility.enabled=true
$ setconfig experimental.evolution=obsolete
$ setconfig experimental.narrow-heads=true
$ setconfig mutation.record=true mutation.enabled=true mutation.user=test mutation.date="0 0"
$ setconfig remotefilelog.reponame=server
$ setconfig hint.ack='*'
$ newrepo server
$ setconfig infinitepush.server=yes infinitepush.indextype=disk infinitepush.storetype=disk infinitepush.reponame=testrepo
$ echo base > base
$ hg commit -Aqm base
$ hg bookmark master
Create a client with some initial commits and sync them to the cloud workspace.
$ cd $TESTTMP
$ hg clone ssh://user@dummy/server client1 -q
$ cd client1
$ setconfig commitcloud.servicetype=local commitcloud.servicelocation=$TESTTMP
$ setconfig commitcloud.user_token_path=$TESTTMP
$ hg cloud auth -t xxxxxx
setting 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'
commitcloud: commits synchronized
finished in * sec (glob)
$ drawdag << EOS
> B D # amend: A -> C -> E
> | | # rebase: B -> D
> A C E
> \|/
> Z
> |
> d20a80d4def3
> EOS
$ tglogm
o 6: c70a9bd6bfd1 'E'
|
| o 5: 6ba5de8abe43 'D'
| |
| x 4: 2d0f0af04f18 'C' (Rewritten using amend into c70a9bd6bfd1)
|/
o 1: dae3b312bb78 'Z'
|
@ 0: d20a80d4def3 'base'
$ 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 4 commits:
remote: dae3b312bb78 Z
remote: 2d0f0af04f18 C
remote: 6ba5de8abe43 D
remote: c70a9bd6bfd1 E
Create another client and use it to modify the commits and create some new ones.
$ cd $TESTTMP
$ hg clone ssh://user@dummy/server client2 -q
$ cd client2
$ setconfig commitcloud.servicetype=local commitcloud.servicelocation=$TESTTMP
$ setconfig commitcloud.user_token_path=$TESTTMP
$ 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 6ba5de8abe43 c70a9bd6bfd1 from ssh://user@dummy/server
searching for changes
adding changesets
adding manifests
adding file changes
added 3 changesets with 3 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 4: c70a9bd6bfd1 'E'
|
| o 3: 6ba5de8abe43 'D'
| |
| x 2: 2d0f0af04f18 'C' (Rewritten using amend into c70a9bd6bfd1)
|/
o 1: dae3b312bb78 'Z'
|
@ 0: d20a80d4def3 'base'
$ hg rebase -r $D -d $E
rebasing 6ba5de8abe43 "D"
$ hg up -q $Z
$ echo X > X
$ hg commit -Aqm X
$ tglogm
@ 6: dd114d9b2f9e 'X'
|
| o 5: d8fc5ae9b7ef 'D'
| |
| o 4: c70a9bd6bfd1 'E'
|/
o 1: dae3b312bb78 'Z'
|
o 0: d20a80d4def3 'base'
$ 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 4 commits:
remote: dae3b312bb78 Z
remote: c70a9bd6bfd1 E
remote: d8fc5ae9b7ef D
remote: dd114d9b2f9e X
Before syncing, create a new commit in the original client
$ cd $TESTTMP/client1
$ hg up -q $E
$ echo F > F
$ hg commit -Aqm F
Also introduce some divergence by rebasing the same commit
$ hg rebase -r $D -d $Z
rebasing 6ba5de8abe43 "D"
Now cloud sync. The sets of commits should be merged.
$ tglogm
o 8: 6caded0e9807 'D'
|
| @ 7: ba83c5428cb2 'F'
| |
| o 6: c70a9bd6bfd1 'E'
|/
o 1: dae3b312bb78 'Z'
|
o 0: d20a80d4def3 'base'
$ hg cloud sync
commitcloud: synchronizing 'server' with 'user/test/default'
backing up stack rooted at dae3b312bb78
pulling d8fc5ae9b7ef dd114d9b2f9e from ssh://user@dummy/server
searching for changes
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
remote: pushing 4 commits:
remote: dae3b312bb78 Z
remote: c70a9bd6bfd1 E
remote: ba83c5428cb2 F
remote: 6caded0e9807 D
commitcloud: commits synchronized
finished in * sec (glob)
$ tglogm
o 10: dd114d9b2f9e 'X'
|
| o 9: d8fc5ae9b7ef 'D'
| |
+---o 8: 6caded0e9807 'D'
| |
| | @ 7: ba83c5428cb2 'F'
| |/
| o 6: c70a9bd6bfd1 'E'
|/
o 1: dae3b312bb78 'Z'
|
o 0: d20a80d4def3 'base'
Cloud sync back to the other client, it should get the same smartlog (apart from ordering).
$ cd $TESTTMP/client2
$ hg cloud sync
commitcloud: synchronizing 'server' with 'user/test/default'
pulling ba83c5428cb2 6caded0e9807 from ssh://user@dummy/server
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 0 changes to 2 files
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 3 files
commitcloud: commits synchronized
finished in * sec (glob)
$ tglogm
o 8: ba83c5428cb2 'F'
|
| o 7: 6caded0e9807 'D'
| |
| | @ 6: dd114d9b2f9e 'X'
| |/
+---o 5: d8fc5ae9b7ef 'D'
| |
o | 4: c70a9bd6bfd1 'E'
|/
o 1: dae3b312bb78 'Z'
|
o 0: d20a80d4def3 'base'
It should also have mutations made on both sides visible.
$ tglogm -r 'predecessors(all())'
o 8: ba83c5428cb2 'F'
|
| o 7: 6caded0e9807 'D'
| |
| | @ 6: dd114d9b2f9e 'X'
| |/
+---o 5: d8fc5ae9b7ef 'D'
| |
o | 4: c70a9bd6bfd1 'E'
|/
| x 3: 6ba5de8abe43 'D' (Rewritten using rebase into 6caded0e9807) (Rewritten using rebase into d8fc5ae9b7ef)
| |
| x 2: 2d0f0af04f18 'C' (Rewritten using amend into c70a9bd6bfd1)
|/
o 1: dae3b312bb78 'Z'
|
o 0: d20a80d4def3 'base'