From cfebc238cbda9b6338ec57d5c215c4cbf0246f8b Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 27 Dec 2009 16:50:36 -0500 Subject: Moved InvalidStorageVersion from libbe.command to libbe.storage Also added ConnectionError pretty-print to ui.command_line, storage version checking to BugDir.duplicate_bugdir(), and optional revision argument to Storage.storage_version(). --- libbe/storage/base.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'libbe/storage/base.py') diff --git a/libbe/storage/base.py b/libbe/storage/base.py index f32353f..b43f765 100644 --- a/libbe/storage/base.py +++ b/libbe/storage/base.py @@ -26,6 +26,16 @@ if TESTING == True: class ConnectionError (Exception): pass +class InvalidStorageVersion(ConnectionError): + def __init__(self, active_version, expected_version=None): + if expected_version == None: + expected_version = libbe.storage.STORAGE_VERSION + msg = 'Storage in "%s" not the expected "%s"' \ + % (active_version, expected_version) + Exception.__init__(self, msg) + self.active_version = active_version + self.expected_version = expected_version + class InvalidID (KeyError): pass @@ -50,6 +60,7 @@ class EmptyCommit(Exception): def __init__(self): Exception.__init__(self, 'No changes to commit') + class Entry (Tree): def __init__(self, id, value=None, parent=None, directory=False, children=None): @@ -134,7 +145,7 @@ class Storage (object): """Return a version string for this backend.""" return '0' - def storage_version(self): + def storage_version(self, revision=None): """Return the storage format for this backend.""" return libbe.storage.STORAGE_VERSION -- cgit