426
426
# revisions. We don't need to see all lines in the inventory because
427
427
# only those added in an inventory in rev X can contain a revision=X
429
for line in w.iter_lines_added_or_present_in_versions(selected_revision_ids):
430
start = line.find('file_id="')+9
431
if start < 9: continue
432
end = line.find('"', start)
434
file_id = _unescape_xml(line[start:end])
429
pb = ui.ui_factory.nested_progress_bar()
431
for line in w.iter_lines_added_or_present_in_versions(
432
selected_revision_ids, pb=pb):
433
start = line.find('file_id="')+9
434
if start < 9: continue
435
end = line.find('"', start)
437
file_id = _unescape_xml(line[start:end])
436
start = line.find('revision="')+10
437
if start < 10: continue
438
end = line.find('"', start)
440
revision_id = _unescape_xml(line[start:end])
441
if revision_id in selected_revision_ids:
442
result.setdefault(file_id, set()).add(revision_id)
439
start = line.find('revision="')+10
440
if start < 10: continue
441
end = line.find('"', start)
443
revision_id = _unescape_xml(line[start:end])
444
if revision_id in selected_revision_ids:
445
result.setdefault(file_id, set()).add(revision_id)
709
714
warning("Format %s for %s is deprecated - please use 'bzr upgrade' to get better performance"
710
715
% (self._format, self.bzrdir.transport.base))
717
def supports_rich_root(self):
718
return self._format.rich_root_data
713
721
class AllInOneRepository(Repository):
714
722
"""Legacy support - the repository behaviour for all-in-one branches."""
777
785
parent_trees[p_id] = repository.revision_tree(None)
779
787
inv = revision_tree.inventory
788
entries = inv.iter_entries()
781
789
# backwards compatability hack: skip the root id.
782
entries = inv.iter_entries()
790
if not repository.supports_rich_root():
791
path, root = entries.next()
792
if root.revision != rev.revision_id:
793
raise errors.IncompatibleRevision(repr(repository))
784
794
# Add the texts that are not already present
785
795
for path, ie in entries:
786
796
w = repository.weave_store.get_weave_or_empty(ie.file_id,
2306
2316
self.new_inventory, self._config)
2307
2317
return self._new_revision_id
2319
def revision_tree(self):
2320
"""Return the tree that was just committed.
2322
After calling commit() this can be called to get a RevisionTree
2323
representing the newly committed tree. This is preferred to
2324
calling Repository.revision_tree() because that may require
2325
deserializing the inventory, while we already have a copy in
2328
return RevisionTree(self.repository, self.new_inventory,
2329
self._new_revision_id)
2309
2331
def finish_inventory(self):
2310
2332
"""Tell the builder that the inventory is finished."""
2311
2333
if self.new_inventory.root is None:
2368
2390
# In this revision format, root entries have no knit or weave
2369
2391
if ie is self.new_inventory.root:
2370
if len(parent_invs):
2371
ie.revision = parent_invs[0].root.revision
2392
# When serializing out to disk and back in
2393
# root.revision is always _new_revision_id
2394
ie.revision = self._new_revision_id
2375
2396
previous_entries = ie.find_previous_heads(