mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
Clean Up: remove everything about the infinitepush write path
Summary: Remove everything about the infinitepush write path. Infinitepush path has been splitted into 2 for migration purpose. It is now time to clean up. Reviewed By: StanislavGlebik Differential Revision: D29711414 fbshipit-source-id: c61799fe124e2def4254cdd45e550c82c501e514
This commit is contained in:
parent
04d32019fa
commit
99ff270a78
@ -308,7 +308,7 @@ Pushbackup to mononoke peer with compression enabled
|
||||
(a larger file is needed to repro problems with zstd compression)
|
||||
$ dd if=/dev/zero of=aa bs=4048 count=1024 2> /dev/null
|
||||
$ hg amend -m "xxx"
|
||||
$ MONONOKE_DIRECT_PEER=1 hgmn cloud backup --config paths.infinitepush-write=mononoke://$(mononoke_address)/repo --dest mononoke://$(mononoke_address)/repo --config infinitepush.bundlecompression=ZS --config mononokepeer.compression=true
|
||||
$ MONONOKE_DIRECT_PEER=1 hgmn cloud backup --dest mononoke://$(mononoke_address)/repo --config infinitepush.bundlecompression=ZS --config mononokepeer.compression=true
|
||||
backing up stack rooted at 47da8b81097c
|
||||
commitcloud: backed up 1 commit
|
||||
|
||||
|
@ -31,7 +31,7 @@ class BackupState(object):
|
||||
Use `readheadsfromall` class method to get the union of what heads has been backed up at different paths.
|
||||
|
||||
After the migration, we should deprecate the current filename convention for the backup cache files.
|
||||
They shouldn't depend on the remotepath and move the whole extension to always use infinitepushwrite path.
|
||||
They shouldn't depend on the remotepath and move the whole extension to always use infinitepush path (infinitepushwrite path should be deprecated).
|
||||
"""
|
||||
|
||||
prefix = "backedupheads."
|
||||
@ -63,9 +63,9 @@ class BackupState(object):
|
||||
# return the cached backedup heads in found
|
||||
if heads:
|
||||
return heads
|
||||
# if no cache found - rebuild it based on the infinitepushwrite remote path
|
||||
# if no cache found - rebuild it based on the infinitepush remote path
|
||||
return BackupState(
|
||||
repo, ccutil.getremotewritepath(repo, None), resetlocalstate=True
|
||||
repo, ccutil.getremotepath(repo, None), resetlocalstate=True
|
||||
).heads
|
||||
|
||||
def __init__(self, repo, remotepath, resetlocalstate=False):
|
||||
|
@ -1353,7 +1353,7 @@ def cloudcheck(ui, repo, dest=None, **opts):
|
||||
nodestocheck = [repo[r].hex() for r in revs]
|
||||
|
||||
if remote:
|
||||
remotepath = ccutil.getremotereadpath(repo, dest)
|
||||
remotepath = ccutil.getremotepath(repo, dest)
|
||||
getconnection = lambda: repo.connectionpool.get(remotepath, opts)
|
||||
isbackedup = {
|
||||
nodestocheck[i]: res
|
||||
|
@ -220,12 +220,8 @@ def _sync(
|
||||
origheads = _getheads(repo)
|
||||
origbookmarks = _getbookmarks(repo)
|
||||
|
||||
readonly = not origheads and not origbookmarks
|
||||
remotepath = (
|
||||
ccutil.getremotereadpath(repo, dest)
|
||||
if readonly
|
||||
else ccutil.getremotepath(repo, dest)
|
||||
)
|
||||
remotepath = ccutil.getremotepath(repo, dest)
|
||||
|
||||
getconnection = lambda: repo.connectionpool.get(
|
||||
remotepath, connect_opts, reason="cloudsync"
|
||||
)
|
||||
|
@ -65,33 +65,8 @@ def getreponame(repo):
|
||||
return reponame
|
||||
|
||||
|
||||
def getremotewritepath(repo, dest):
|
||||
"""Select an appopriate remote repository to connect to for read/write commit cloud operations.
|
||||
|
||||
If dest is empty, pass in None to get the default path.
|
||||
Priorities: 'infinitepushwrite', 'infinitepush', 'default'
|
||||
"""
|
||||
pathname = dependencies.infinitepush.constants.pathname
|
||||
path = repo.ui.paths.getpath(
|
||||
dest or None,
|
||||
default=(pathname.infinitepushwrite, pathname.infinitepush, pathname.default),
|
||||
)
|
||||
if not path:
|
||||
raise error.Abort(
|
||||
_(
|
||||
"none of 'infinitepushwrite', 'infinitepush', 'default' repositories configured!"
|
||||
),
|
||||
hint=_("see 'hg help config.paths'"),
|
||||
)
|
||||
return path.pushloc or path.loc
|
||||
|
||||
|
||||
# alias
|
||||
getremotepath = getremotewritepath
|
||||
|
||||
|
||||
def getremotereadpath(repo, dest):
|
||||
"""Select an appopriate remote repository to connect to for readonly commit cloud operations.
|
||||
def getremotepath(repo, dest):
|
||||
"""Select an appopriate remote repository to connect to for commit cloud operations.
|
||||
|
||||
If dest is empty, pass in None to get the default path.
|
||||
Priorities: 'infinitepush', 'default'
|
||||
|
@ -113,30 +113,16 @@ def preparepush(ui, dest):
|
||||
# scratch push, then we're going to go to the infinitepush destination
|
||||
# instead, if it exists. When you do a scratch push, "default" means the infinitepush path.
|
||||
if dest == pathname.default:
|
||||
try:
|
||||
return ui.paths.getpath(pathname.infinitepushwrite)
|
||||
except error.RepoError:
|
||||
# Fallthrough to the next block.
|
||||
pass
|
||||
|
||||
try:
|
||||
return ui.paths.getpath(pathname.infinitepush)
|
||||
except error.RepoError:
|
||||
# Fallthrough to the next block.
|
||||
pass
|
||||
|
||||
if dest == pathname.infinitepush:
|
||||
try:
|
||||
return ui.paths.getpath(pathname.infinitepushwrite)
|
||||
except error.RepoError:
|
||||
# Fallthrough to the next block.
|
||||
pass
|
||||
|
||||
if dest in {None, pathname.default, pathname.infinitepush}:
|
||||
path = ui.paths.getpath(
|
||||
dest,
|
||||
default=(
|
||||
pathname.infinitepushwrite,
|
||||
pathname.infinitepush,
|
||||
pathname.defaultpush,
|
||||
pathname.default,
|
||||
@ -388,7 +374,6 @@ def _resetinfinitepushpath(repo, ui, **opts):
|
||||
overrides = {}
|
||||
defaultpath = pathname.default
|
||||
infinitepushpath = pathname.infinitepush
|
||||
infinitepushwritepath = pathname.infinitepushwrite
|
||||
infinitepushbookmarkpath = pathname.infinitepushbookmark
|
||||
|
||||
if opts.get("bookmark"):
|
||||
@ -418,7 +403,6 @@ def _resetinfinitepushpath(repo, ui, **opts):
|
||||
if path is not None:
|
||||
overrides[("paths", defaultpath)] = ui.paths[path].loc
|
||||
overrides[("paths", infinitepushpath)] = "!"
|
||||
overrides[("paths", infinitepushwritepath)] = "!"
|
||||
overrides[("paths", infinitepushbookmarkpath)] = "!"
|
||||
with ui.configoverride(overrides, "infinitepush"):
|
||||
loc, sub = ui.configsuboptions("paths", defaultpath)
|
||||
@ -428,7 +412,6 @@ def _resetinfinitepushpath(repo, ui, **opts):
|
||||
for p in [
|
||||
infinitepushpath,
|
||||
infinitepushbookmarkpath,
|
||||
infinitepushwritepath,
|
||||
]:
|
||||
if p not in ui.paths:
|
||||
continue
|
||||
|
@ -14,4 +14,3 @@ class pathname(object):
|
||||
defaultpush = "default-push"
|
||||
infinitepush = "infinitepush"
|
||||
infinitepushbookmark = "infinitepushbookmark"
|
||||
infinitepushwrite = "infinitepush-write"
|
||||
|
@ -526,7 +526,6 @@ segmentedchangelogcompatiblelist = """
|
||||
test-infinitepush-remotefilelog.t
|
||||
test-infinitepush-remotenames.t
|
||||
test-infinitepush-scratchbookmark-commands.t
|
||||
test-infinitepush-write.t
|
||||
test-init.t
|
||||
test-issue1502.t
|
||||
test-issue522.t
|
||||
|
@ -43,6 +43,6 @@ Verify smartlog shows only the configured data
|
||||
stable
|
||||
|
||||
note: background backup is currently disabled so your commits are not being backed up.
|
||||
abort: none of 'infinitepushwrite', 'infinitepush', 'default' repositories configured!
|
||||
abort: none of 'infinitepush', 'default' repositories configured!
|
||||
(see 'hg help config.paths')
|
||||
[255]
|
||||
|
@ -1,142 +0,0 @@
|
||||
#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]
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
> default = dotdot://server
|
||||
> default-push = push://server
|
||||
> infinitepush = i://server
|
||||
> infinitepush-write = iw://server
|
||||
> normal-path = mononoke://mononoke.internal.tfbnw.net/server
|
||||
> [remotefilelog]
|
||||
> fallbackpath = fallback://server
|
||||
@ -39,7 +38,6 @@ test converting debug output for all paths
|
||||
paths.default=ssh://user@dummy/server (expanded from dotdot://server)
|
||||
paths.default-push=ssh://user@dummy/server (expanded from push://server)
|
||||
paths.infinitepush=ssh://user@dummy/server (expanded from i://server)
|
||||
paths.infinitepush-write=ssh://user@dummy/server (expanded from iw://server)
|
||||
paths.normal-path=mononoke://mononoke.internal.tfbnw.net/server (not expanded)
|
||||
|
||||
check that paths are expanded
|
||||
@ -70,7 +68,7 @@ expanding an unknown scheme emits the input
|
||||
|
||||
$ mkcommit something
|
||||
$ hg push -r . --to scratch/test123 --create
|
||||
pushing to iw://server/
|
||||
pushing to i://server/
|
||||
searching for changes
|
||||
remote: pushing 1 commit:
|
||||
remote: 6e16a5f9c216 something
|
||||
|
Loading…
Reference in New Issue
Block a user