161
162
def _diff(self, text_diff, from_label, tree, to_label, to_entry, to_tree,
162
163
output_to, reverse=False):
163
164
"""Perform a diff between two entries of the same kind."""
165
def find_previous_heads(self, previous_inventories,
166
versioned_file_store,
169
"""Return the revisions and entries that directly precede this.
171
Returned as a map from revision to inventory entry.
173
This is a map containing the file revisions in all parents
174
for which the file exists, and its revision is not a parent of
175
any other. If the file is new, the set will be empty.
177
:param versioned_file_store: A store where ancestry data on this
178
file id can be queried.
179
:param transaction: The transaction that queries to the versioned
180
file store should be completed under.
181
:param entry_vf: The entry versioned file, if its already available.
166
def parent_candidates(self, previous_inventories):
167
"""Find possible per-file graph parents.
169
This is currently defined by:
170
- The kind has not changed (* not sure why this is a clause *)
171
- Select the last changed revision in the parent inventory.
172
- Do deal with a short lived bug in bzr 0.8's development two entries
173
that have the same last changed but different 'x' bit settings are
183
def get_ancestors(weave, entry):
184
return set(weave.get_ancestry(entry.revision, topo_sorted=False))
185
176
# revision:ie mapping for each ie found in previous_inventories.
187
# revision:ie mapping with one revision for each head.
189
# revision: ancestor list for each head
191
178
# identify candidate head revision ids.
192
179
for inv in previous_inventories:
193
180
if self.file_id in inv:
213
200
# add this revision as a candidate.
214
201
candidates[ie.revision] = ie
204
@deprecated_method(zero_ninetyone)
205
def find_previous_heads(self, previous_inventories,
206
versioned_file_store,
209
"""Return the revisions and entries that directly precede this.
211
Returned as a map from revision to inventory entry.
213
This is a map containing the file revisions in all parents
214
for which the file exists, and its revision is not a parent of
215
any other. If the file is new, the set will be empty.
217
:param versioned_file_store: A store where ancestry data on this
218
file id can be queried.
219
:param transaction: The transaction that queries to the versioned
220
file store should be completed under.
221
:param entry_vf: The entry versioned file, if its already available.
223
candidates = self.parent_candidates(previous_inventories)
225
# revision:ie mapping with one revision for each head.
216
227
# common case optimisation
217
228
if len(candidates) == 1:
218
229
# if there is only one candidate revision found
219
# then we can opening the versioned file to access ancestry:
230
# then we can avoid opening the versioned file to access ancestry:
220
231
# there cannot be any ancestors to eliminate when there is
221
232
# only one revision available.
222
heads[ie.revision] = ie
235
# --- what follows is now encapsulated in repository.get_graph.heads(),
236
# but that is not accessible from here as we have no repository
237
# pointer. Note that the repository.get_graph.heads() call can return
238
# different results *at the moment* because of the kind-changing check
239
# we have in parent_candidates().
225
241
# eliminate ancestors amongst the available candidates:
226
242
# heads are those that are not an ancestor of any other candidate
227
243
# - this provides convergence at a per-file level.
244
def get_ancestors(weave, entry):
245
return set(weave.get_ancestry(entry.revision, topo_sorted=False))
246
# revision: ancestor list for each head
228
248
for ie in candidates.values():
229
249
# may be an ancestor of a known head:
230
250
already_present = 0 != len(