lfs: add a 'null' store that doesn't require any setup

Summary:
We have to use the dummy store to ensure we don't try to open an HTTP
connection during push, which can fail and must not happen during p4fastimport.
However `dummy` requires some configuration. So just add an internal `null`
store that allows us to operate LFS in a mode that will ignore all large files
completely.

Test Plan: used it in p4fastimport

Reviewers: #sourcecontrol, quark

Reviewed By: quark

Subscribers: quark, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4963638

Signature: t1:4963638:1493316573:c012bd97794f9a57c3cf8c15d868a67ae3c03c31
This commit is contained in:
David Soria Parra 2017-04-27 11:13:54 -07:00
parent 2b12f514c7
commit f8bb4e2122
2 changed files with 20 additions and 1 deletions

View File

@ -10,7 +10,7 @@ Configs::
remoteuser = user
# password for HTTP auth
remotepassword = password
# blobstore type. "git-lfs", or "dummy" (test-only)
# blobstore type. "git-lfs", "dummy" (test-only), or "null" (interal use)
remotestore = git-lfs
# local filesystem path (only used by the dummy blobstore, test-only)
remotepath = /tmp/test

View File

@ -209,9 +209,28 @@ class _dummyremote(object):
filename = os.path.join(self._storepath, storeid.oid)
return filename
class _nullremote(object):
"""Null store storing blobs to /dev/null."""
def __init__(self, repo):
pass
def write(self, storeid, data):
pass
def read(self, storeid):
raise NotImplementedError()
def writebatch(self, storeids, fromstore, ui=None, total=None):
pass
def readbatch(self, storeids, tostore, ui=None, total=None):
pass
_storemap = {
'git-lfs': _gitlfsremote,
'dummy': _dummyremote,
'null': _nullremote,
}
def remote(repo):