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

265 lines
5.9 KiB
Perl

#chg-compatible
This test tries to exercise the ssh functionality with a dummy script
(enable general delta early)
$ setconfig format.usegeneraldelta=yes
$ configure dummyssh
$ checknewrepo()
> {
> name=$1
> if [ -d "$name"/.hg/store ]; then
> echo store created
> fi
> if [ -f "$name"/.hg/00changelog.i ]; then
> echo 00changelog.i created
> fi
> cat "$name"/.hg/requires
> }
creating 'local'
$ hg init local
$ checknewrepo local
store created
00changelog.i created
dotencode
fncache
generaldelta
lz4revlog
revlogv1
store
treestate
$ echo this > local/foo
$ hg ci --cwd local -A -m "init"
adding foo
test custom revlog chunk cache sizes
$ hg --config format.chunkcachesize=0 log -R local -pv
abort: revlog chunk cache size 0 is not greater than 0!
[255]
$ hg --config format.chunkcachesize=1023 log -R local -pv
abort: revlog chunk cache size 1023 is not a power of 2!
[255]
$ hg --config format.chunkcachesize=1024 log -R local -pv
commit: 08b9e9f63b32
user: test
date: Thu Jan 01 00:00:00 1970 +0000
files: foo
description:
init
diff -r 000000000000 -r 08b9e9f63b32 foo
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/foo Thu Jan 01 00:00:00 1970 +0000
@@ -0,0 +1,1 @@
+this
creating repo with format.usefncache=false
$ hg --config format.usefncache=false init old2
$ checknewrepo old2
store created
00changelog.i created
generaldelta
lz4revlog
revlogv1
store
treestate
creating repo with format.dotencode=false
$ hg --config format.dotencode=false init old3
$ checknewrepo old3
store created
00changelog.i created
fncache
generaldelta
lz4revlog
revlogv1
store
treestate
creating repo with format.dotencode=false
$ hg --config format.generaldelta=false --config format.usegeneraldelta=false init old4
$ checknewrepo old4
store created
00changelog.i created
dotencode
fncache
lz4revlog
revlogv1
store
treestate
test failure
$ hg init local
abort: repository local already exists!
[255]
init+push to remote2
$ hg init ssh://user@dummy/remote2
$ hg incoming -R remote2 local
comparing with local
commit: 08b9e9f63b32
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: init
$ hg push -R local ssh://user@dummy/remote2
pushing to ssh://user@dummy/remote2
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
clone to remote1
$ hg clone local ssh://user@dummy/remote1
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
init to existing repo
$ hg clone local ssh://user@dummy/remotelf
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
$ hg init ssh://user@dummy/remote1
abort: repository remote1 already exists!
abort: could not create remote repo!
[255]
clone to existing repo
$ hg clone local ssh://user@dummy/remote1
abort: repository remote1 already exists!
abort: could not create remote repo!
[255]
output of dummyssh
$ cat dummylog
Got arguments 1:user@dummy 2:hg init remote2
Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio
Got arguments 1:user@dummy 2:hg -R remote2 serve --stdio
Got arguments 1:user@dummy 2:hg init remote1
Got arguments 1:user@dummy 2:hg -R remote1 serve --stdio
Got arguments 1:user@dummy 2:hg init remotelf
Got arguments 1:user@dummy 2:hg -R remotelf serve --stdio
Got arguments 1:user@dummy 2:hg init remote1
Got arguments 1:user@dummy 2:hg init remote1
comparing repositories
$ hg tip -q -R local
08b9e9f63b32
$ hg tip -q -R remote1
08b9e9f63b32
$ hg tip -q -R remote2
08b9e9f63b32
check names for repositories (clashes with URL schemes, special chars)
$ for i in bundle file hg http https old-http ssh static-http "with space"; do
> printf "hg init \"$i\"... "
> hg init "$i"
> test -d "$i" -a -d "$i/.hg" && echo "ok" || echo "failed"
> done
hg init "bundle"... ok
hg init "file"... ok
hg init "hg"... ok
hg init "http"... ok
hg init "https"... ok
hg init "old-http"... ok
hg init "ssh"... ok
hg init "static-http"... ok
hg init "with space"... ok
#if eol-in-paths
/* " " is not a valid name for a directory on Windows */
$ hg init " "
$ test -d " "
$ test -d " /.hg"
#endif
creating 'local/sub/repo'
$ hg init local/sub/repo
$ checknewrepo local/sub/repo
store created
00changelog.i created
dotencode
fncache
generaldelta
lz4revlog
revlogv1
store
treestate
prepare test of init of url configured from paths
$ echo '[paths]' >> $HGRCPATH
$ echo "somewhere = `pwd`/url from paths" >> $HGRCPATH
$ echo "elsewhere = `pwd`/another paths url" >> $HGRCPATH
init should (for consistency with clone) expand the url
$ hg init somewhere
$ checknewrepo "url from paths"
store created
00changelog.i created
dotencode
fncache
generaldelta
lz4revlog
revlogv1
store
treestate
verify that clone also expand urls
$ hg clone somewhere elsewhere
updating to branch default
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ checknewrepo "another paths url"
store created
00changelog.i created
dotencode
fncache
generaldelta
lz4revlog
revlogv1
store
treestate
clone bookmarks
$ hg -R local bookmark test
$ hg -R local bookmarks
* test 08b9e9f63b32
$ hg clone local ssh://user@dummy/remote-bookmarks
searching for changes
exporting bookmark test
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
$ hg -R remote-bookmarks bookmarks
test 08b9e9f63b32