diff options
author | W. Trevor King <wking@drexel.edu> | 2009-12-27 16:50:36 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-12-27 16:50:36 -0500 |
commit | cfebc238cbda9b6338ec57d5c215c4cbf0246f8b (patch) | |
tree | 30efcc0f354a175220814ea5d4e74dd2d71fa2fb /libbe/storage/vcs/base.py | |
parent | dff704764d77bffbf6cc94c5ba4bb03309da45f8 (diff) | |
download | bugseverywhere-cfebc238cbda9b6338ec57d5c215c4cbf0246f8b.tar.gz |
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().
Diffstat (limited to 'libbe/storage/vcs/base.py')
-rw-r--r-- | libbe/storage/vcs/base.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libbe/storage/vcs/base.py b/libbe/storage/vcs/base.py index 1df08cf..e96b466 100644 --- a/libbe/storage/vcs/base.py +++ b/libbe/storage/vcs/base.py @@ -32,6 +32,7 @@ import re import shutil import sys import tempfile +import types import libbe import libbe.storage @@ -885,15 +886,19 @@ os.listdir(self.get_path("bugs")): if version != libbe.storage.STORAGE_VERSION: upgrade.upgrade(self.repo, version) - def storage_version(self, path=None): + def storage_version(self, revision=None, path=None): """ Requires disk access. """ if path == None: path = os.path.join(self.repo, '.be', 'version') - return libbe.util.encoding.get_file_contents( - path, decode=True).rstrip('\n') - + if revision == None: # don't require connection + return libbe.util.encoding.get_file_contents( + path, decode=True).rstrip('\n') + contents = self._vcs_get_file_contents(path, revision=revision) + if type(contents) != types.UnicodeType: + contents = unicode(contents, self.encoding) + return contents.strip() if libbe.TESTING == True: |