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