sapling/tests/integration/test-init.t
Stanislau Hlebik 97032c01fc mononoke: fetch full file history
Summary:
remotefilelog getfiles method requires fetching the whole history. Current
implementation is naive and it's going to be slow on big repos.
But later we're going to replace it with mysql

Reviewed By: quark-zju

Differential Revision: D6913180

fbshipit-source-id: 9244272a0339a2a83cf5b5615963b65ad2fcdc07
2018-02-13 08:54:31 -08:00

205 lines
4.4 KiB
Perl

$ . $TESTDIR/library.sh
setup configuration
$ setup_config_repo
$ cd $TESTTMP
setup common configuration
$ cat >> $HGRCPATH <<EOF
> [ui]
> ssh="$DUMMYSSH"
> EOF
setup repo
$ hg init repo-hg
Init treemanifest and remotefilelog
$ cd repo-hg
$ cat >> .hg/hgrc <<EOF
> [extensions]
> treemanifest=
> remotefilelog=
> [treemanifest]
> server=True
> [remotefilelog]
> server=True
> shallowtrees=True
> EOF
$ touch a
$ hg add a
$ hg ci -ma
$ hg log
changeset: 0:3903775176ed
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: a
$ cd $TESTTMP
setup repo2
$ cat >> $HGRCPATH <<EOF
> [extensions]
> remotefilelog=
> [remotefilelog]
> cachepath=$TESTTMP/cachepath
> EOF
$ hgcloneshallow ssh://user@dummy/repo-hg repo2 --noupdate
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 0 changes to 0 files
new changesets 3903775176ed
$ cd repo2
$ cat >> .hg/hgrc <<EOF
> [extensions]
> treemanifest=
> remotefilelog=
> [treemanifest]
> server=False
> treeonly=True
> [remotefilelog]
> server=False
> reponame=repo
> EOF
$ hg pull
pulling from ssh://user@dummy/repo-hg
searching for changes
no changes found
$ cd $TESTTMP
$ cd repo-hg
$ touch b
$ hg add b
$ hg ci -mb
$ echo content > c
$ hg add c
$ hg ci -mc
$ mkdir dir
$ echo 1 > dir/1
$ mkdir dir2
$ echo 2 > dir/2
$ hg addremove
adding dir/1
adding dir/2
$ hg ci -m 'new directory'
$ echo cc > c
$ hg addremove
$ hg ci -m 'modify file'
$ hg debugdrawdag <<'EOS'
> D # D/D=1\n2\n
> /| # B/D=1\n
> B C # C/D=2\n
> |/ # A/D=x\n
> A
> EOS
$ hg log --graph -T '{node|short} {desc}'
o e635b24c95f7 D
|\
| o d351044ef463 C
| |
o | 9a827afb7e25 B
|/
o af6aa0dfdf3d A
@ 329b10223740 modify file
|
o a42a44555d7c new directory
|
o 3e19bf519e9a c
|
o 0e067c57feba b
|
o 3903775176ed a
$ cd ..
$ blobimport --blobstore files --linknodes repo-hg repo
blobimport currently doesn't handle bookmarks, but server requires the directory.
$ mkdir -p repo/books
Need a place for the socket to live
$ mkdir -p repo/.hg
start mononoke
$ mononoke -P $TESTTMP/mononoke-config -B test-config
$ wait_for_mononoke $TESTTMP/repo
$ hgmn debugwireargs ssh://user@dummy/repo one two --three three
one two three None None
$ cd repo2
$ hg up 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hgmn pull ssh://user@dummy/repo --traceback
pulling from ssh://user@dummy/repo
searching for changes
adding changesets
adding manifests
adding file changes
added 8 changesets with 0 changes to 0 files (+1 heads)
new changesets af6aa0dfdf3d:329b10223740
(run 'hg heads' to see heads, 'hg merge' to merge)
$ hg log -r '3903775176ed::329b10223740' --graph -T '{node|short} {desc}'
o 329b10223740 modify file
|
o a42a44555d7c new directory
|
o 3e19bf519e9a c
|
o 0e067c57feba b
|
@ 3903775176ed a
$ ls
a
$ hgmn --config paths.default=ssh://user@dummy/repo up a42a44555d7c
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ ls
a
b
c
dir
$ cat c
content
$ hgmn --config paths.default=ssh://user@dummy/repo up 329b10223740
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg log c -T '{node|short} {desc}\n'
warning: file log can be slow on large repos - use -f to speed it up
329b10223740 modify file
3e19bf519e9a c
$ cat dir/1
1
$ cat dir/2
2
$ hgmn --config paths.default=ssh://user@dummy/repo up e635b24c95f7
4 files updated, 0 files merged, 5 files removed, 0 files unresolved
Sort the output because the output is unpredictable because of merges
$ hg log D --follow -T '{node|short} {desc}\n' | sort
e635b24c95f7 D
9a827afb7e25 B
d351044ef463 C
af6aa0dfdf3d A
Create a new bookmark and try and send it over the wire
Test commented while we have no bookmark support in blobimport or easy method
to create a fileblob bookmark
# $ cd ../repo
# $ hg bookmark test-bookmark
# $ hg bookmarks
# * test-bookmark 0:3903775176ed
# $ cd ../repo2
# $ hgmn pull ssh://user@dummy/repo
# pulling from ssh://user@dummy/repo
# searching for changes
# no changes found
# adding remote bookmark test-bookmark
# $ hg bookmarks
# test-bookmark 0:3903775176ed