sapling/eden/hg-server/tests/test-clone-uncompressed.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

126 lines
3.8 KiB
Perl

#chg-compatible
$ disable treemanifest
$ configure dummyssh
#require serve
Initialize repository
the status call is to check for issue5130
$ hg init server
$ cd server
$ touch foo
$ hg -q commit -A -m initial
>>> for i in range(1024):
... with open(str(i), 'w') as fh:
... x = fh.write("%s" % (str(i),))
$ hg -q commit -A -m 'add a lot of files'
$ hg st
$ cd ..
Basic clone
$ hg clone --stream -U ssh://user@dummy/server clone1
streaming all changes
1028 files to transfer, * of data (glob)
transferred * in * seconds (*) (glob)
searching for changes
no changes found
Block full streaming clones
$ cat >> server/.hg/hgrc <<EOF
> [server]
> requireexplicitfullclone=True
> EOF
$ hg clone --stream -U ssh://user@dummy/server blockedclone
streaming all changes
remote: unable to perform an implicit streaming clone - make sure remotefilelog is enabled (?)
abort: locking the remote repository failed
remote: unable to perform an implicit streaming clone - make sure remotefilelog is enabled (?)
[255]
$ hg clone --stream --config clone.requestfullclone=True -U ssh://user@dummy/server blockedclone
streaming all changes
* files to transfer, * of data (glob)
transferred * in * seconds (*) (glob)
searching for changes
no changes found
$ rm server/.hg/hgrc
--uncompressed is an alias to --stream
$ hg clone --uncompressed -U ssh://user@dummy/server clone1-uncompressed
streaming all changes
1028 files to transfer, * of data (glob)
transferred * in * seconds (*) (glob)
searching for changes
no changes found
Clone with background file closing enabled
$ hg --debug --config worker.backgroundclose=true --config worker.backgroundcloseminfilecount=1 clone --stream -U ssh://user@dummy/server clone-background 2>&1 | grep -v adding
running * 'user@dummy' 'hg -R server serve --stdio' (glob)
sending hello command
sending between command
remote: 408
remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash unbundlereplay batch streamreqs=generaldelta,lz4revlog,revlogv1 stream_option $USUAL_BUNDLE2_CAPS$ unbundle=HG10GZ,HG10BZ,HG10UN
remote: 1
streaming all changes
sending stream_out_option command
1028 files to transfer, * of data (glob)
transferred * in * seconds (*) (glob)
query 1; heads
sending batch command
searching for changes
local heads: 1; remote heads: 1 (explicit: 0); initial common: 1
all remote heads known locally
no changes found
sending getbundle command
bundle2-input-bundle: with-transaction
bundle2-input-part: "listkeys" (params: 1 mandatory) supported
bundle2-input-part: "phase-heads" supported
bundle2-input-part: total payload size 24
bundle2-input-bundle: 1 parts total
checking for updated bookmarks
Stream clone while repo is changing:
$ mkdir changing
$ cd changing
extension for delaying the server process so we reliably can modify the repo
while cloning
$ cat > delayer.py <<EOF
> import time
> from edenscm.mercurial import extensions, vfs
> def __call__(orig, self, path, *args, **kwargs):
> if path == 'data/f1.i':
> time.sleep(2)
> return orig(self, path, *args, **kwargs)
> extensions.wrapfunction(vfs.vfs, '__call__', __call__)
> EOF
prepare repo with small and big file to cover both code paths in emitrevlogdata
$ hg init repo
$ touch repo/f1
$ $TESTDIR/seq.py 50000 > repo/f2
$ hg -R repo ci -Aqm "0"
$ cat >>repo/.hg/hgrc <<EOF
> [extensions]
> delayer=$TESTTMP/changing/delayer.py
> EOF
clone while modifying the repo between stating file with write lock and
actually serving file content
$ hg clone -q --stream -U ssh://user@dummy/changing/repo clone &
$ sleep 1
$ echo >> repo/f1
$ echo >> repo/f2
$ hg -R repo ci -m "1"
$ wait
$ hg -R clone id
000000000000