116
122
or at least passing a description to the constructor.
119
def __init__(self, weave_store, inv, revision_id):
120
self._weave_store = weave_store
125
def __init__(self, branch, inv, revision_id):
126
self._branch = branch
127
self._weave_store = branch.weave_store
121
128
self._inventory = inv
122
129
self._revision_id = revision_id
124
131
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.
127
132
import bzrlib.transactions as transactions
128
133
return self._weave_store.get_weave(file_id,
129
transactions.PassThroughTransaction())
134
self._branch.get_transaction())
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())
132
141
def get_file_lines(self, file_id):
133
142
ie = self._inventory[file_id]
134
143
weave = self.get_weave(file_id)
135
144
return weave.get(ie.revision)
138
146
def get_file_text(self, file_id):
139
147
return ''.join(self.get_file_lines(file_id))
142
149
def get_file(self, file_id):
143
150
return StringIO(self.get_file_text(file_id))