sapling/eden/hg-server/tests/test-commitcloud-checkoutlocations-update.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

81 lines
2.7 KiB
Perl

#chg-compatible
$ configure dummyssh
$ enable infinitepush commitcloud
$ enable amend
$ setconfig infinitepush.branchpattern="re:scratch/.*"
$ setconfig commitcloud.hostname=testhost
$ setconfig experimental.graphstyle.grandparent=2.
$ setconfig templatealias.sl_cloud="\"{truncatelonglines(node, 6)} {ifeq(phase, 'public', '(public)', '')} {ifeq(phase, 'draft', author, '')} {date|isodate} {bookmarks}\\n{desc|firstline}\\n \""
$ setconfig remotefilelog.reponame=server
$ hg init server
$ cd server
$ setconfig infinitepush.server=yes infinitepush.indextype=disk infinitepush.storetype=disk infinitepush.reponame=testrepo
Make the clone of the server
$ hg clone ssh://user@dummy/server client -q
$ cd client
$ setconfig commitcloud.servicetype=local commitcloud.servicelocation="$TESTTMP" commitcloud.token_enforced=False
Enable syncing checkout locations
$ setconfig commitcloud.synccheckoutlocations=True
Utility script to dump json of the checkoutlocation being sent
$ cat > $TESTTMP/dumpdata.py <<EOF
> import json
> import os
> testtmp = os.environ['TESTTMP']
> path = os.path.join(testtmp, "checkoutlocations")
> location = json.load(open(path))
> print("repo_name: %s" % location["repo_name"])
> print("workspace: %s" % location["workspace"])
> print("hostname: %s" % location["hostname"])
> print("commit: %s" % location["commit"])
> print("shared_path: %s" % location["shared_path"])
> print("checkout_path: %s" % location["checkout_path"])
> print("unixname: %s" % location["unixname"])
> EOF
Make a random commit
$ echo a > a
$ hg add a
$ hg commit -m"commit"
Check that the checkout locations are synced after the commit is made
$ python $TESTTMP/dumpdata.py
repo_name: server
workspace: user/test/default
hostname: * (glob)
commit: bb757c825e81d15d6959648d8f055c8e5958310f
shared_path: $TESTTMP/server/client/.hg
checkout_path: $TESTTMP/server/client/.hg
unixname: test
Make changes and amend
$ echo aa > a
$ hg amend
Check that the checkout locations are synced after the amend is made
$ python $TESTTMP/dumpdata.py
repo_name: server
workspace: user/test/default
hostname: * (glob)
commit: b7ad20e4fc527a09952053de497603c0a8eafd0d
shared_path: $TESTTMP/server/client/.hg
checkout_path: $TESTTMP/server/client/.hg
unixname: test
Checkout the old commit and see if the location is synced
$ hg checkout bb757c825e81d15d6959648d8f055c8e5958310f --hidden
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ python $TESTTMP/dumpdata.py
repo_name: server
workspace: user/test/default
hostname: * (glob)
commit: bb757c825e81d15d6959648d8f055c8e5958310f
shared_path: $TESTTMP/server/client/.hg
checkout_path: $TESTTMP/server/client/.hg
unixname: test