diff options
Diffstat (limited to 'libbe/storage/__init__.py')
-rw-r--r-- | libbe/storage/__init__.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/libbe/storage/__init__.py b/libbe/storage/__init__.py index 7abe791..b6b0ac1 100644 --- a/libbe/storage/__init__.py +++ b/libbe/storage/__init__.py @@ -36,15 +36,24 @@ STORAGE_VERSIONS = ['Bugs Everywhere Tree 1 0', # the current version STORAGE_VERSION = STORAGE_VERSIONS[-1] -def get_storage(location): - """ - Return a Storage instance from a repo location string. - """ +def get_http_storage(location): + import http + return http.HTTP(location) + +def get_vcs_storage(location): import vcs s = vcs.detect_vcs(location) s.repo = location return s +def get_storage(location): + """ + Return a Storage instance from a repo location string. + """ + if location.startswith('http://'): + return get_http_storage(location) + return get_vcs_storage(location) + __all__ = [ConnectionError, InvalidStorageVersion, InvalidID, InvalidRevision, InvalidDirectory, NotWriteable, NotReadable, EmptyCommit, STORAGE_VERSIONS, STORAGE_VERSION, |