122
116
or at least passing a description to the constructor.
125
def __init__(self, branch, inv, revision_id):
126
self._branch = branch
127
self._weave_store = branch.weave_store
119
def __init__(self, weave_store, inv, revision_id):
120
self._weave_store = weave_store
128
121
self._inventory = inv
129
122
self._revision_id = revision_id
131
124
def get_weave(self, file_id):
125
# FIXME: RevisionTree should be given a branch
126
# not a store, or the store should know the branch.
132
127
import bzrlib.transactions as transactions
133
128
return self._weave_store.get_weave(file_id,
134
self._branch.get_transaction())
129
transactions.PassThroughTransaction())
136
def get_weave_prelude(self, file_id):
137
import bzrlib.transactions as transactions
138
return self._weave_store.get_weave_prelude(file_id,
139
self._branch.get_transaction())
141
132
def get_file_lines(self, file_id):
142
133
ie = self._inventory[file_id]
143
134
weave = self.get_weave(file_id)
144
135
return weave.get(ie.revision)
146
138
def get_file_text(self, file_id):
147
139
return ''.join(self.get_file_lines(file_id))
149
142
def get_file(self, file_id):
150
143
return StringIO(self.get_file_text(file_id))