aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2010-01-18 09:28:16 -0500
committerW. Trevor King <wking@drexel.edu>2010-01-18 09:28:16 -0500
commitbfd72d4fcd742ee356ec22d2fa4de5e2db23dde2 (patch)
tree1375db810603f72f2a9f9ec663af524d865c87e4 /libbe
parentba583f2af95291bf210da819978810dbbb9bfb56 (diff)
downloadbugseverywhere-bfd72d4fcd742ee356ec22d2fa4de5e2db23dde2.tar.gz
Moved BugDir.duplicate_bugdir to RevisionedBugDir class
Diffstat (limited to 'libbe')
-rw-r--r--libbe/bugdir.py29
1 files changed, 18 insertions, 11 deletions
diff --git a/libbe/bugdir.py b/libbe/bugdir.py
index 951a4d5..90c21e1 100644
--- a/libbe/bugdir.py
+++ b/libbe/bugdir.py
@@ -292,23 +292,23 @@ class BugDir (list, settings_object.SavedSettingsObject):
def sibling_uuids(self):
return []
- # methods for managing duplicate BugDirs
-
- def duplicate_bugdir(self, revision):
- """
- Duplicate bugdirs are read-only copies used for generating
- diffs between revisions.
- """
- storage_version = self.storage.storage_version(revision)
+class RevisionedBugDir (BugDir):
+ """
+ RevisionedBugDirs are read-only copies used for generating
+ diffs between revisions.
+ """
+ def __init__(self, bugdir, revision):
+ storage_version = bugdir.storage.storage_version(revision)
if storage_version != libbe.storage.STORAGE_VERSION:
raise libbe.storage.InvalidStorageVersion(storage_version)
- s = copy.deepcopy(self.storage)
+ s = copy.deepcopy(bugdir.storage)
s.writeable = False
class RevisionedStorage (object):
def __init__(self, storage, default_revision):
self.s = storage
self.sget = self.s.get
self.schildren = self.s.children
+ self.schanged = self.s.changed
self.r = default_revision
def get(self, *args, **kwargs):
if not 'revision' in kwargs or kwargs['revision'] == None:
@@ -318,10 +318,16 @@ class BugDir (list, settings_object.SavedSettingsObject):
if not 'revision' in kwargs or kwargs['revision'] == None:
kwargs['revision'] = self.r
return self.schildren(*args, **kwargs)
+ def changed(self, *args, **kwargs):
+ if not 'revision' in kwargs or kwargs['revision'] == None:
+ kwargs['revision'] = self.r
+ return self.schanged(*args, **kwargs)
rs = RevisionedStorage(s, revision)
s.get = rs.get
s.children = rs.children
- dbd = BugDir(s, from_storage=True)
+ s.changed = rs.changed
+ BugDir.__init__(self, s, from_storage=True)
+ self.revision = revision
# dbd = copy.copy(self)
# dbd.storage = copy.copy(self.storage)
# dbd._bug_map = copy.copy(self._bug_map)
@@ -368,7 +374,8 @@ class BugDir (list, settings_object.SavedSettingsObject):
# else:
# assert 1==0, 'Unkown type "%s" for id "%s"' % (type, id)
# dbd.storage.readable = False # so we won't read in added bugs, etc.
- return dbd
+# return dbd
+
if libbe.TESTING == True:
class SimpleBugDir (BugDir):