mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 17:27:53 +03:00
0aaa4577bc
Summary: Streaming clones are a neat hack; we get to send files down to the Mercurial client, which it then writes out as-is. Usefully, we can send no files, and the protocol still works. Set up the capabilities etc needed so that we send streaming clones to Mercurial clients, even if they're rather useless so far. Reviewed By: StanislavGlebik Differential Revision: D9926967 fbshipit-source-id: b543e802adac38c8bc318081eec364aed87b0231
109 lines
3.1 KiB
Perl
109 lines
3.1 KiB
Perl
$ . $TESTDIR/library.sh
|
|
|
|
setup configuration
|
|
$ setup_common_config
|
|
$ cd $TESTTMP
|
|
|
|
setup repo
|
|
|
|
$ hg init repo-hg
|
|
|
|
setup hg server repo
|
|
$ cd repo-hg
|
|
$ setup_hg_server
|
|
$ cd $TESTTMP
|
|
|
|
setup client repo2
|
|
$ hgclone_treemanifest ssh://user@dummy/repo-hg repo2 --noupdate -q
|
|
$ cd repo2
|
|
$ setup_hg_client
|
|
|
|
make a few commits on the server
|
|
$ cd $TESTTMP/repo-hg
|
|
$ hg debugdrawdag <<EOF
|
|
> C
|
|
> |
|
|
> B
|
|
> |
|
|
> A
|
|
> EOF
|
|
|
|
create master bookmark
|
|
|
|
$ hg bookmark master_bookmark -r tip
|
|
|
|
blobimport them into Mononoke storage and start Mononoke
|
|
$ cd ..
|
|
$ blobimport repo-hg/.hg repo
|
|
|
|
start mononoke
|
|
|
|
$ mononoke
|
|
$ wait_for_mononoke $TESTTMP/repo
|
|
|
|
Pull from Mononoke
|
|
$ cd repo2
|
|
$ hgmn pull -q
|
|
warning: stream clone requested but client is missing requirements: lz4revlog
|
|
(see https://www.mercurial-scm.org/wiki/MissingRequirement for more information)
|
|
|
|
Make sure that cache is empty
|
|
$ [[ -a $TESTTMP/cachepath/repo/packs/manifests ]]
|
|
[1]
|
|
|
|
$ hgmn prefetch -r 0 -r1
|
|
remote: * DEBG Session with Mononoke started with uuid: * (glob)
|
|
remote: * DEBG Session with Mononoke started with uuid: * (glob)
|
|
$ hgmn prefetch -r 2
|
|
remote: * DEBG Session with Mononoke started with uuid: * (glob)
|
|
remote: * DEBG Session with Mononoke started with uuid: * (glob)
|
|
|
|
Make sure that new entries were downloaded
|
|
$ [[ -a $TESTTMP/cachepath/repo/packs/manifests ]]
|
|
$ ls $TESTTMP/cachepath/repo/packs/manifests | wc -l
|
|
8
|
|
|
|
Update to the revisions. Change the path to make sure that gettreepack command is
|
|
not sent because we've already downloaded all the trees
|
|
$ hgmn up 2 --config paths.default=ssh://brokenpath -q
|
|
$ ls
|
|
A
|
|
B
|
|
C
|
|
|
|
Change the path to make sure that no wireproto commands should be sent at all,
|
|
because everything has been already downloaded.
|
|
$ hgmn up 1 --config paths.default=ssh://brokenpath -q
|
|
$ ls
|
|
A
|
|
B
|
|
|
|
$ cat >> $TESTTMP/gettreepack.py <<EOF
|
|
> from mercurial import registrar
|
|
> from mercurial.node import bin
|
|
> from mercurial import (bundle2, extensions)
|
|
> cmdtable = {}
|
|
> command = registrar.command(cmdtable)
|
|
> @command('gettreepack', [
|
|
> ('', 'mfnode', [], 'specify the manifest revisions', 'REV'),
|
|
> ], '[-r REV]')
|
|
> def _gettreepack(ui, repo, **opts):
|
|
> treemanifestext = extensions.find('treemanifest')
|
|
> fallbackpath = treemanifestext.getfallbackpath(repo)
|
|
> with repo.connectionpool.get(fallbackpath) as conn:
|
|
> remote = conn.peer
|
|
> depth = 100
|
|
> bundle = remote.gettreepack('', [bin(mfnode) for mfnode in opts.get('mfnode')], [], [], depth)
|
|
> bundle2.processbundle(repo, bundle, None)
|
|
> EOF
|
|
|
|
$ hgmn --config extensions.gettreepack=$TESTTMP/gettreepack.py gettreepack --mfnode 1111111111111111111111111111111111111111
|
|
remote: * DEBG Session with Mononoke started with uuid: * (glob)
|
|
remote: * ERRO Command failed, remote: true, error: Manifest id 1111111111111111111111111111111111111111 is missing, root_cause: ManifestMissing( (glob)
|
|
remote: HgNodeHash(
|
|
remote: Sha1(1111111111111111111111111111111111111111)
|
|
remote: )
|
|
remote: ), backtrace: , session_uuid: * (glob)
|
|
abort: stream ended unexpectedly (got 0 bytes, expected 4)
|
|
[255]
|