sapling/eden/hg-server/tests/test-commitcloud-sync-remote-bookmarks.t
Durham Goode 98d9269874 server: copy hg to a new hg-server directory
Summary:
Create a fork of the Mercurial code that we can use to build server
rpms. The hg servers will continue to exist for a few more months while we move
the darkstorm and ediscovery use cases off them. In the mean time, we want to
start making breaking changes to the client, so let's create a stable copy of
the hg code to produce rpms for the hg servers.

The fork is based off c7770c78d, the latest hg release.

This copies the files as is, then adds some minor tweaks to get it to build:
- Disables some lint checks that appear to be bypassed by path
- sed replace eden/scm with eden/hg-server
- Removed a dependency on scm/telemetry from the edenfs-client tests since
  scm/telemetry pulls in the original eden/scm/lib/configparser which conflicts
  with the hg-server conflict parser.

allow-large-files

Reviewed By: quark-zju

Differential Revision: D27632557

fbshipit-source-id: b2f442f4ec000ea08e4d62de068750832198e1f4
2021-04-09 10:09:06 -07:00

301 lines
6.6 KiB
Raku

#chg-compatible
$ enable amend commitcloud infinitepush remotenames
$ disable treemanifest
$ configure dummyssh
$ setconfig remotenames.autopullhoistpattern=re:.*
$ setconfig commitcloud.hostname=testhost
$ setconfig remotefilelog.reponame=server
$ mkcommit() {
> echo $1 > $1
> hg add $1
> hg ci -m "$1"
> }
$ showgraph() {
> hg log -G -T "{desc}: {phase} {bookmarks} {remotenames}"
> }
Setup remote repo
$ hg init remoterepo
$ cd remoterepo
$ setconfig infinitepush.server=yes infinitepush.reponame=testrepo
$ setconfig infinitepush.indextype=disk infinitepush.storetype=disk
$ mkcommit root
$ ROOT=$(hg log -r . -T{node})
$ mkcommit c1 serv
$ hg book warm
$ hg up $ROOT -q
$ mkcommit b1 serv
$ hg book stable
$ hg book main
$ hg up $ROOT -q
$ mkcommit a1 serv
$ mkcommit a2 serv
$ hg book master
$ showgraph
@ a2: draft master
o a1: draft
o b1: draft main stable
├─╯
o c1: draft warm
├─╯
o root: draft
Setup first client repo and subscribe to the bookmarks "stable" and "warm".
$ cd ..
$ setconfig remotenames.selectivepull=True
$ setconfig remotenames.selectivepulldefault=master
$ setconfig commitcloud.remotebookmarkssync=True
$ hg clone -q ssh://user@dummy/remoterepo client1
$ cd client1
$ hg pull -B stable -B warm -q
$ hg up 'desc(a2)' -q
$ setconfig commitcloud.servicetype=local commitcloud.servicelocation=$TESTTMP commitcloud.token_enforced=False
$ hg cloud join -q
$ showgraph
@ a2: public default/master
o a1: public
o b1: public default/stable
o c1: public default/warm
o root: public
Setup the second client repo with enable remote bookmarks sync
The repo should be subscribed the "stable" and "warm" bookmark because the client1 was.
$ cd ..
$ hg clone -q ssh://user@dummy/remoterepo client2
$ cd client2
$ setconfig commitcloud.servicetype=local commitcloud.servicelocation=$TESTTMP commitcloud.token_enforced=False
$ hg cloud join -q
$ showgraph
@ a2: public default/master
o a1: public
o b1: public default/stable
o c1: public default/warm
o root: public
Setup third client repo but do not enable remote bookmarks sync
$ cd ..
$ hg clone -q ssh://user@dummy/remoterepo client3
$ cd client3
$ setconfig commitcloud.servicetype=local commitcloud.servicelocation=$TESTTMP commitcloud.token_enforced=False
$ setconfig commitcloud.remotebookmarkssync=False
$ hg cloud join -q
$ showgraph
@ a2: public default/master
o a1: public
o root: public
Common case of unsynchronized remote bookmarks ("master")
$ cd ../remoterepo
$ mkcommit a3 serv
$ cd ../client2
$ hg pull -q
$ hg up master -q
$ mkcommit draft-1
$ hg cloud sync -q
$ showgraph
@ draft-1: draft
o a3: public default/master
o a2: public
o a1: public
o b1: public default/stable
o c1: public default/warm
o root: public
default/master should point to the new commit
$ cd ../client1
$ hg cloud sync -q
$ showgraph
o draft-1: draft
o a3: public default/master
@ a2: public
o a1: public
o b1: public default/stable
o c1: public default/warm
o root: public
Subscribe to a new remote bookmark "main" that previously has been only known on the server
$ cd ../client1
$ hg pull -q
$ hg pull -B main -q
$ hg cloud sync -q
$ showgraph
o draft-1: draft
o a3: public default/master
@ a2: public
o a1: public
o b1: public default/main default/stable
o c1: public default/warm
o root: public
$ hg book --list-subscriptions
default/main b2bfab231667
default/master 1b6e90080435
default/stable b2bfab231667
default/warm b8063fc7de93
the other client should be subscribed to this bookmark ("main") as well
$ cd ../client2
$ hg cloud sync -q
$ showgraph
@ draft-1: draft
o a3: public default/master
o a2: public
o a1: public
o b1: public default/main default/stable
o c1: public default/warm
o root: public
$ hg book --list-subscriptions
default/main b2bfab231667
default/master 1b6e90080435
default/stable b2bfab231667
default/warm b8063fc7de93
try to create a commit on top of the default/stable
$ cd ../client1
$ hg up stable -q
$ mkcommit draft-2
$ hg cloud sync -q
$ cd ../client2
$ hg cloud sync -q
$ showgraph
o draft-2: draft
@ draft-1: draft
o a3: public default/master
o a2: public
o a1: public
o b1: public default/main default/stable
o c1: public default/warm
o root: public
check that copy with disabled remote bookmarks sync doesn't affect the other copies
$ cd ../client1
$ hg up warm -q
$ mkcommit draft-3
$ hg cloud sync -q
$ showgraph
@ draft-3: draft
o draft-2: draft
o draft-1: draft
o a3: public default/master
o a2: public
o a1: public
o b1: public default/main default/stable
o c1: public default/warm
o root: public
sync and create a new commit on top of the draft-3
$ cd ../client3
$ hg cloud sync -q
$ hg up dc05efd94c6626ddd820e8d98b745ad6b50b82fc -q
$ echo check >> check
$ hg commit -qAm "draft-4"
$ showgraph
@ draft-4: draft
o draft-2: draft
o draft-1: draft
│ │
│ │ o draft-3: draft
│ │ │
oa3: draft
│ │ │
oa2: public default/master
│ │ │
oa1: public
│ │ │
o │ │ b1: draft
├─╯ │
o c1: draft
├───╯
o root: public
$ hg cloud sync -q
$ cd ../client2
$ hg cloud sync -q
$ showgraph
o draft-4: draft
o draft-3: draft
o draft-2: draft
@ draft-1: draft
o a3: public default/master
o a2: public
o a1: public
o b1: public default/main default/stable
o c1: public default/warm
o root: public
$