~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
428
428
        # line.
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)
433
 
            assert end>= 0
434
 
            file_id = _unescape_xml(line[start:end])
 
429
        pb = ui.ui_factory.nested_progress_bar()
 
430
        try:
 
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)
 
436
                assert end>= 0
 
437
                file_id = _unescape_xml(line[start:end])
435
438
 
436
 
            start = line.find('revision="')+10
437
 
            if start < 10: continue
438
 
            end = line.find('"', start)
439
 
            assert end>= 0
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)
 
442
                assert end>= 0
 
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)
 
446
        finally:
 
447
            pb.finished()
443
448
        return result
444
449
 
445
450
    @needs_read_lock
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))
711
716
 
 
717
    def supports_rich_root(self):
 
718
        return self._format.rich_root_data
 
719
 
712
720
 
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)
778
786
 
779
787
    inv = revision_tree.inventory
780
 
    
 
788
    entries = inv.iter_entries()
781
789
    # backwards compatability hack: skip the root id.
782
 
    entries = inv.iter_entries()
783
 
    entries.next()
 
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
2308
2318
 
 
2319
    def revision_tree(self):
 
2320
        """Return the tree that was just committed.
 
2321
 
 
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
 
2326
        memory.
 
2327
        """
 
2328
        return RevisionTree(self.repository, self.new_inventory,
 
2329
                            self._new_revision_id)
 
2330
 
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:
2367
2389
 
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
2372
 
            else:
2373
 
                ie.revision = None
 
2392
            # When serializing out to disk and back in
 
2393
            # root.revision is always _new_revision_id
 
2394
            ie.revision = self._new_revision_id
2374
2395
            return
2375
2396
        previous_entries = ie.find_previous_heads(
2376
2397
            parent_invs,