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

143 lines
3.9 KiB
Perl

#chg-compatible
$ enable remotefilelog
$ enable treemanifest
Setup the test
$ . "$TESTDIR/library.sh"
$ . "$TESTDIR/infinitepush/library.sh"
$ setupcommon
$ enable infinitepush pushrebase
$ cat >> "$HGRCPATH" << EOF
> [treemanifest]
> sendtrees=True
> treeonly=True
> EOF
$ cp "$HGRCPATH" "$TESTTMP/defaulthgrc"
$ hg init repo1
$ cd repo1
$ setupserver
$ cat >> .hg/hgrc << EOF
> [treemanifest]
> server=true
> EOF
$ cd ..
$ hg init repo2
$ cd repo2
$ setupserver
$ cat >> .hg/hgrc << EOF
> [treemanifest]
> server=true
> EOF
$ cd ..
$ hg init repo3
$ cd repo3
$ setupserver
$ cat >> .hg/hgrc << EOF
> [treemanifest]
> server=true
> EOF
$ cd ..
Check that we push to the write path if it is present
$ hg clone ssh://user@dummy/repo1 client -q
$ cp "$TESTTMP/defaulthgrc" "$HGRCPATH"
$ cat >> "$HGRCPATH" << EOF
> [paths]
> default-push=ssh://user@dummy/repo3
> infinitepush=ssh://user@dummy/repo1
> infinitepush-write=ssh://user@dummy/repo2
> [remotefilelog]
> fallbackpath=ssh://user@dummy/repo2
> [infinitepush]
> branchpattern=re:scratch/.+
> EOF
$ cd client
$ mkcommit initialcommit
$ hg push -r . --to scratch/test123 --create
pushing to ssh://user@dummy/repo2
searching for changes
remote: pushing 1 commit:
remote: 67145f466344 initialcommit
$ mkcommit morecommit
$ hg push infinitepush -r . --to scratch/test123
pushing to ssh://user@dummy/repo2
searching for changes
remote: pushing 2 commits:
remote: 67145f466344 initialcommit
remote: 6b2f28e02245 morecommit
$ mkcommit anothercommit
$ hg push default -r . --to scratch/test123
pushing to ssh://user@dummy/repo2
searching for changes
remote: pushing 3 commits:
remote: 67145f466344 initialcommit
remote: 6b2f28e02245 morecommit
remote: 17528c345014 anothercommit
-- check that we fallback to non-write path, when write path is not there
$ mkcommit yetanothercommit
$ hg push -r . --to scratch/test123 --create --config paths.infinitepush-write=
pushing to ssh://user@dummy/repo1
searching for changes
remote: pushing 4 commits:
remote: 67145f466344 initialcommit
remote: 6b2f28e02245 morecommit
remote: 17528c345014 anothercommit
remote: 8785135185c9 yetanothercommit
$ cd ..
Check that we pull/update from the read path, regardless of the write path presence
$ hg clone ssh://user@dummy/repo1 client2 -q
$ cp "$TESTTMP/defaulthgrc" "$HGRCPATH"
$ cat >> "$HGRCPATH" << EOF
> [paths]
> infinitepush=ssh://user@dummy/repo2
> infinitepush-write=ssh://user@dummy/repo3
> [remotefilelog]
> fallbackpath=ssh://user@dummy/repo2
> [infinitepush]
> branchpattern=re:scratch/.+
> EOF
$ cd client2
$ mkcommit initialcommit
$ hg pull -r 67145f466344
pulling from ssh://user@dummy/repo2
no changes found
adding changesets
adding manifests
adding file changes
added 0 changesets with 0 changes to 1 files
$ hg update -r 6b2f28e02245
pulling '6b2f28e02245' from 'ssh://user@dummy/repo2'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-- check that we can pull from read path, when write path is not present
$ hg pull -r 8785135185c9 --config paths.infinitepush-write= --config paths.infinitepush=ssh://user@dummy/repo1
pulling from ssh://user@dummy/repo1
searching for changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 4 files
$ cd ..
Check that infinitepush writes can be disabled by a config
$ cat >> "$TESTTMP/repo1/.hg/hgrc" <<EOF
> [infinitepush]
> server.denywrites=very good reason
> EOF
$ cd "$TESTTMP/client"
$ mkcommit ababagalamaga
$ hg push -r . --to scratch/ababagalamaga --create --config paths.infinitepush-write=ssh://user@dummy/repo1
pushing to ssh://user@dummy/repo1
searching for changes
remote: infinitepush writes are disabled on this server: very good reason
abort: push failed on remote
[255]