1 # Copyright (C) 2009-2012 Chris Ball <cjb@laptop.org>
2 # W. Trevor King <wking@drexel.edu>
4 # This file is part of Bugs Everywhere.
6 # Bugs Everywhere is free software: you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by the Free
8 # Software Foundation, either version 2 of the License, or (at your option) any
11 # Bugs Everywhere is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 # You should have received a copy of the GNU General Public License along with
17 # Bugs Everywhere. If not, see <http://www.gnu.org/licenses/>.
19 """Define the :class:`~libbe.storage.base.Storage` and
20 :class:`~libbe.storage.base.VersionedStorage` classes for storing BE
23 Also define assorted implementations for the Storage classes:
25 * :mod:`libbe.storage.vcs`
26 * :mod:`libbe.storage.http`
28 Also define an assortment of storage-related tools and utilities:
30 * :mod:`libbe.storage.util`
35 ConnectionError = base.ConnectionError
36 InvalidStorageVersion = base.InvalidStorageVersion
37 InvalidID = base.InvalidID
38 InvalidRevision = base.InvalidRevision
39 InvalidDirectory = base.InvalidDirectory
40 NotWriteable = base.NotWriteable
41 NotReadable = base.NotReadable
42 EmptyCommit = base.EmptyCommit
44 # a list of all past versions
45 STORAGE_VERSIONS = ['Bugs Everywhere Tree 1 0',
46 'Bugs Everywhere Directory v1.1',
47 'Bugs Everywhere Directory v1.2',
48 'Bugs Everywhere Directory v1.3',
49 'Bugs Everywhere Directory v1.4',
50 'Bugs Everywhere Directory v1.5',
54 STORAGE_VERSION = STORAGE_VERSIONS[-1]
56 def get_http_storage(location):
58 return http.HTTP(location)
60 def get_vcs_storage(location):
62 s = vcs.detect_vcs(location)
66 def get_storage(location):
68 Return a Storage instance from a repo location string.
70 if location.startswith('http://') or location.startswith('https://'):
71 return get_http_storage(location)
72 return get_vcs_storage(location)
74 __all__ = [ConnectionError, InvalidStorageVersion, InvalidID,
75 InvalidRevision, InvalidDirectory, NotWriteable, NotReadable,
76 EmptyCommit, STORAGE_VERSIONS, STORAGE_VERSION,