sapling/eden/scm/tests/test-commitcloud-sync-rb-enabling.t

203 lines
4.9 KiB
Perl
Raw Normal View History

#chg-compatible
$ enable amend commitcloud infinitepush remotenames
$ configure dummyssh
$ setconfig commitcloud.hostname=testhost
$ setconfig remotefilelog.reponame=server
$ showgraph() {
> hg log -G -T "{desc}: {phase} {bookmarks} {remotenames}" -r "all()"
> }
$ newserver server
$ cd $TESTTMP/server
$ echo base > base
$ hg commit -Aqm base
$ hg bookmark base
$ hg bookmark master
$ setconfig infinitepush.server=yes infinitepush.reponame=testrepo
$ setconfig infinitepush.indextype=disk infinitepush.storetype=disk
$ cd $TESTTMP
$ clone server client1
$ cd client1
$ setconfig remotenames.selectivepull=True
$ setconfig remotenames.selectivepulldefault=master,base
$ setconfig remotenames.selectivepullaccessedbookmarks=True
$ setconfig commitcloud.remotebookmarkssync=True
$ setconfig commitcloud.servicetype=local commitcloud.servicelocation=$TESTTMP commitcloud.token_enforced=False
$ 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 0.00 sec
$ showgraph
@ base: public default/base default/master
$ cd $TESTTMP
$ clone server client2
$ cd client2
$ setconfig remotenames.selectivepull=True
$ setconfig remotenames.selectivepulldefault=master,base
$ setconfig remotenames.selectivepullaccessedbookmarks=True
$ setconfig commitcloud.servicetype=local commitcloud.servicelocation=$TESTTMP commitcloud.token_enforced=False
$ 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 0.00 sec
$ showgraph
@ base: public default/base default/master
Advance master
$ cd $TESTTMP/server
$ echo more >> base
$ hg commit -Aqm public1
Pull in client1 (remote bookmarks sync enabled)
$ cd $TESTTMP/client1
$ hg pull -q
$ hg cloud sync -q
$ showgraph
o public1: public default/master
@ base: public default/base
Sync in client2 (remote bookmarks sync disabled). The master bookmark doesn't move
$ cd $TESTTMP/client2
$ hg cloud sync -q
$ showgraph
o public1: draft
@ base: public default/base default/master
Sync in client2 with sync enabled
$ hg cloud sync -q --config commitcloud.remotebookmarkssync=true
$ showgraph
o public1: public default/master
@ base: public default/base
commitcloud: handle missing remotebookmarks in commitcloud lastsyncstate Summary: During the roll-out of commitcloud remotebookmarks sync, some clients may have it enabled, and others may have it disabled. This can result in some clients having an empty set of remotebookmarks in their sync state for a version which actually does have remotenames in the cloud workspace. This becomes a problem when those clients start syncing remotebookmarks, for two reasons: * They are unable to correctly apply the new cloud remotebookmarks, as they do not have the previous state with which to break ties, and the tie-breaking code doesn't work correctly if the old cloud remotebookmark is `None`. * When they try to send the remotebookmarks delta to the server, they don't have the old state, and so compute the delta incorrectly. This results in `Duplicate entry for key` errors in the service. We can handle this as follows: * When syncing remote bookmarks from the cloud, ensure we correctly apply the remote bookmark updates, even if the old cloud remotebookmark is `None`. * If the local repo is up-to-date with respect to the workspace, but the last sync state had no remote bookmarks recorded, sync the remote bookmarks again. This may involve pulling some more commits if the cloud remote bookmarks are ahead of the local remote bookmarks. If there truly were no remote bookmarks then this will be a no-op. Reviewed By: quark-zju Differential Revision: D20792360 fbshipit-source-id: cd1ed371d8d5b1be2767c8a8d4836ea870a4467b
2020-04-01 23:24:11 +03:00
Sync in client1 again.
$ cd $TESTTMP/client1
$ hg cloud sync -q
$ showgraph
o public1: public default/master
@ base: public default/base
Sync in client2 again (remote bookmarks sync disabled)
$ cd $TESTTMP/client2
$ hg cloud sync -q
$ showgraph
o public1: public default/master
@ base: public default/base
Advance master
$ cd $TESTTMP/server
$ echo more >> base
$ hg commit -Aqm public2
Pull in client1 and sync
$ cd $TESTTMP/client1
$ hg pull -q
$ hg cloud sync -q
$ showgraph
o public2: public default/master
o public1: public
@ base: public default/base
commitcloud: handle missing remotebookmarks in commitcloud lastsyncstate Summary: During the roll-out of commitcloud remotebookmarks sync, some clients may have it enabled, and others may have it disabled. This can result in some clients having an empty set of remotebookmarks in their sync state for a version which actually does have remotenames in the cloud workspace. This becomes a problem when those clients start syncing remotebookmarks, for two reasons: * They are unable to correctly apply the new cloud remotebookmarks, as they do not have the previous state with which to break ties, and the tie-breaking code doesn't work correctly if the old cloud remotebookmark is `None`. * When they try to send the remotebookmarks delta to the server, they don't have the old state, and so compute the delta incorrectly. This results in `Duplicate entry for key` errors in the service. We can handle this as follows: * When syncing remote bookmarks from the cloud, ensure we correctly apply the remote bookmark updates, even if the old cloud remotebookmark is `None`. * If the local repo is up-to-date with respect to the workspace, but the last sync state had no remote bookmarks recorded, sync the remote bookmarks again. This may involve pulling some more commits if the cloud remote bookmarks are ahead of the local remote bookmarks. If there truly were no remote bookmarks then this will be a no-op. Reviewed By: quark-zju Differential Revision: D20792360 fbshipit-source-id: cd1ed371d8d5b1be2767c8a8d4836ea870a4467b
2020-04-01 23:24:11 +03:00
Sync in client 2 with remotebookmarks sync enabled.
$ cd $TESTTMP/client2
$ hg cloud sync -q --config commitcloud.remotebookmarkssync=true
$ showgraph
o public2: public default/master
o public1: public
@ base: public default/base
Delete the base bookmark on the server
$ cd $TESTTMP/server
$ hg book -d base
Pull in client 1, which removes the base remote bookmark
$ cd $TESTTMP/client1
$ hg pull -q
$ showgraph
o public2: public default/master
o public1: public
@ base: public
Make an update to the cloud workspace in client 2 with remotebookmarks sync disabled
$ cd $TESTTMP/client2
$ hg book local1
$ hg cloud sync -q
$ showgraph
o public2: public default/master
o public1: public
@ base: public local1 default/base
Sync in client1, deleted base bookmark remains deleted
$ cd $TESTTMP/client1
$ hg cloud sync -q
$ showgraph
o public2: public default/master
o public1: public
@ base: public local1
Sync in client2 with remote bookmarks sync enabled
$ cd $TESTTMP/client2
$ hg cloud sync -q --config commitcloud.remotebookmarkssync=true
$ showgraph
o public2: public default/master
o public1: public
@ base: public local1 default/base
Pull in client 2, base bookmark is now deleted
$ hg pull
pulling from ssh://user@dummy/server
no changes found
$ hg cloud sync -q
$ showgraph
o public2: public default/master
o public1: public
@ base: public local1
And remains deleted in client 1
$ cd $TESTTMP/client1
$ hg cloud sync -q
$ showgraph
o public2: public default/master
o public1: public
@ base: public local1