aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/bugdir.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2008-11-24 07:31:51 -0500
committerW. Trevor King <wking@drexel.edu>2008-11-24 07:31:51 -0500
commitd248dbca39e1e8a26a5aa9d39b28038690a406a0 (patch)
treef730cd2e12e0d328b91b3636f2a30356c39c9da6 /libbe/bugdir.py
parent63a7726eba738fe2ed340027039ba655ff91898a (diff)
downloadbugseverywhere-d248dbca39e1e8a26a5aa9d39b28038690a406a0.tar.gz
Replaced direct filesystem read from bugdir.py with RCS mediated read.
Also replaced utility.FileString with StringIO() in cmdutil.py, which allowed the removal of utility.FileString and utility.get_file. The only remaining file().read() outside the RCS framework is the read in utility.editor_string(), but should probably not go through the RCS.
Diffstat (limited to 'libbe/bugdir.py')
-rw-r--r--libbe/bugdir.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/libbe/bugdir.py b/libbe/bugdir.py
index 175f518..d3b7e61 100644
--- a/libbe/bugdir.py
+++ b/libbe/bugdir.py
@@ -140,13 +140,16 @@ class BugDir (list):
return beroot
def get_version(self, path=None):
+ if self.rcs_name == None:
+ # Use a temporary RCS to check the version for the first time
+ RCS = rcs.rcs_by_name("None")
+ RCS.root(self.root)
+ else:
+ RCS = self.rcs
+
if path == None:
path = self.get_path("version")
- try:
- tree_version = self.rcs.get_file_contents(path)
- except AttributeError, e:
- # haven't initialized rcs yet
- tree_version = file(path, "rb").read().decode("utf-8")
+ tree_version = RCS.get_file_contents(path)
return tree_version
def set_version(self):
@@ -234,7 +237,7 @@ that the Arch RCS backend *enforces* ids with this format.""")
raise NoBugDir(self.get_path())
self.settings = self._get_settings(self.get_path("settings"))
- self.rcs = rcs.rcs_by_name(self.rcs_name) # set real RCS
+ self.rcs = rcs.rcs_by_name(self.rcs_name)
if self._user_id != None: # was a user name in the settings file
self.save_user_id()