mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
30e39de418
Summary: In order to support gradual rollout of infinitepush for other backends (e.g. Mononoke), we need the ability to route read vs write requests separately. To achieve this, we need a separate path type: `infinitepush-write` (kind of like `default-push`, the naming inconsistency is a little unfortunate, as I don't want to use `infinitepush-push`). The desired behavior of the new path type is as follows: - takes precedence over `infinitepush` path when the user does `hg push -r . --to scratch/bla` - replaces `infinitepush` path when the user does `hg push infinitepush -r . --to scratch/bla` - absence of this path means draft pushes will go to `infinitepush` path - draft pulls always go to `infinitepush` path, and *there's no fallback to `infinitepush-write`* - commit cloud always talks to `infinitepush-write`, if it is present (meaning that commit cloud pulls do go to `infinitepush-write` path - this is done, as commitcloud uses infinitepush paths to also check whether something is backed up - and also, commitcloud may need to pull very soon after something has been pushed Reviewed By: quark-zju Differential Revision: D20368158 fbshipit-source-id: 59db174cebbf2b48765dff37bc93aad176c2d7c1
135 lines
3.7 KiB
Perl
135 lines
3.7 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
|
|
'6b2f28e02245' does not exist locally - looking for it remotely...
|
|
pulling from ssh://user@dummy/repo2
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 2 files
|
|
'6b2f28e02245' found remotely
|
|
pull finished in * (glob)
|
|
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 ..
|