1
# A handle object for convenience in opening a svn repository
5
# We need a bsddb linked to the same version of Berkeley DB as Subversion is
12
sys.modules['svnfs_bsddb'] = bsddb
14
from svnfs_bsddb.db import *
17
def __init__(self, dbhome, readonly=None):
18
self.env = self.uuids_db = self.revs_db = self.txns_db = self.changes_db \
19
= self.copies_db = self.nodes_db = self.reps_db = self.strings_db = \
23
self.env.set_lk_detect(DB_LOCK_RANDOM)
24
self.env.set_get_returns_none(1)
25
self.env.open(dbhome, DB_CREATE | DB_INIT_MPOOL | DB_INIT_TXN \
26
| DB_INIT_LOCK | DB_INIT_LOG)
32
db.open(dbname, flags=dbflags)
34
self.uuids_db = open_db('uuids')
35
self.revs_db = open_db('revisions')
36
self.txns_db = open_db('transactions')
37
self.changes_db = open_db('changes')
38
self.copies_db = open_db('copies')
39
self.nodes_db = open_db('nodes')
40
self.reps_db = open_db('representations')
41
self.strings_db = open_db('strings')
47
def close_if_not_None(i):
50
close_if_not_None(self.uuids_db )
51
close_if_not_None(self.revs_db )
52
close_if_not_None(self.txns_db )
53
close_if_not_None(self.changes_db )
54
close_if_not_None(self.copies_db )
55
close_if_not_None(self.nodes_db )
56
close_if_not_None(self.reps_db )
57
close_if_not_None(self.strings_db )
58
close_if_not_None(self.env )
59
self.env = self.uuids_db = self.revs_db = self.txns_db = self.changes_db \
60
= self.copies_db = self.nodes_db = self.reps_db = self.strings_db = \
63
# And now, some utility functions
64
def get_whole_string(self, key):
65
cur = self.strings_db.cursor()
72
str = str + (rec[1] or "")