mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
lfs: let blobstore.local and blobstore.remote take an repo argument
Summary: Previously local takes a path, remote takes a ui. This diff makes it more consistent. Test Plan: `rt test-lfs.t` Reviewers: #mercurial, simonfar Reviewed By: simonfar Subscribers: mjpieters Differential Revision: https://phabricator.intern.facebook.com/D4812884 Signature: t1:4812884:1491211049:6b3709e3b7e054b11d4a3f9a92e7921fe55de9fa
This commit is contained in:
parent
ead899b26b
commit
00e6156a07
@ -27,8 +27,10 @@ class local(object):
|
||||
to be uploaded to the remote blobstore.
|
||||
"""
|
||||
|
||||
def __init__(self, path):
|
||||
self.vfs = lfsutil.lfsvfs(path)
|
||||
def __init__(self, repo):
|
||||
storepath = repo.ui.config('lfs', 'blobstore', 'cache/localblobstore')
|
||||
fullpath = repo.vfs.join(storepath)
|
||||
self.vfs = lfsutil.lfsvfs(fullpath)
|
||||
|
||||
@staticmethod
|
||||
def get(opener):
|
||||
@ -53,7 +55,8 @@ class local(object):
|
||||
|
||||
class remote(object):
|
||||
|
||||
def __init__(self, ui):
|
||||
def __init__(self, repo):
|
||||
ui = repo.ui
|
||||
url = ui.config('lfs', 'remoteurl', None)
|
||||
user = ui.config('lfs', 'remoteuser', None)
|
||||
password = ui.config('lfs', 'remotepassword', None)
|
||||
@ -176,8 +179,8 @@ class remote(object):
|
||||
class dummy(object):
|
||||
"""Dummy store storing blobs to temp directory."""
|
||||
|
||||
def __init__(self, ui):
|
||||
path = ui.config('lfs', 'remotepath', None)
|
||||
def __init__(self, repo):
|
||||
path = repo.ui.config('lfs', 'remotepath', None)
|
||||
if path is None:
|
||||
raise error.ProgrammingError('dummystore: must set "remotepath"')
|
||||
try:
|
||||
|
@ -18,9 +18,7 @@ def threshold(ui, repo):
|
||||
|
||||
def localblobstore(ui, repo):
|
||||
"""Configure local blobstore"""
|
||||
storepath = ui.config('lfs', 'blobstore', 'cache/localblobstore')
|
||||
localblobstore = blobstore.local(repo.vfs.join(storepath))
|
||||
repo.svfs.lfslocalblobstore = localblobstore
|
||||
repo.svfs.lfslocalblobstore = blobstore.local(repo)
|
||||
|
||||
def chunking(ui, repo):
|
||||
"""Configure chunking for massive blobs to be split into smaller chunks."""
|
||||
@ -37,4 +35,4 @@ def remoteblobstore(ui, repo):
|
||||
if not remotestore in knownblobstores:
|
||||
message = _("Unknown remote store %s") % (remotestore)
|
||||
raise error.ProgrammingError(message)
|
||||
repo.svfs.lfsremoteblobstore = knownblobstores[remotestore](ui)
|
||||
repo.svfs.lfsremoteblobstore = knownblobstores[remotestore](repo)
|
||||
|
Loading…
Reference in New Issue
Block a user