/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Robert Collins
  • Date: 2009-03-25 05:08:42 UTC
  • mto: This revision was merged to the branch mainline in revision 4216.
  • Revision ID: robertc@robertcollins.net-20090325050842-maz9t0tio264dcya
Enable record_iter_changes for cases where it can work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
327
327
            raise AssertionError("recording deletes not activated.")
328
328
        delta = (path, None, file_id, None)
329
329
        self._basis_delta.append(delta)
 
330
        self._any_changes = True
330
331
        return delta
331
332
 
332
333
    def will_record_deletes(self):
561
562
            has been generated against. Currently assumed to be the same
562
563
            as self.parents[0] - if it is not, errors may occur.
563
564
        :param iter_changes: An iter_changes iterator with the changes to apply
564
 
            to basis_revision_id.
 
565
            to basis_revision_id. The iterator must not include any items with
 
566
            a current kind of None - missing items must be either filtered out
 
567
            or errored-on beefore record_iter_changes sees the item.
565
568
        :param _entry_factory: Private method to bind entry_factory locally for
566
569
            performance.
567
570
        :return: A generator of (file_id, relpath, fs_hash) tuples for use with
578
581
        # {file_id -> revision_id -> inventory entry, for entries in parent
579
582
        # trees that are not parents[0]
580
583
        parent_entries = {}
581
 
        revtrees = list(self.repository.revision_trees(self.parents))
 
584
        ghost_basis = False
 
585
        try:
 
586
            revtrees = list(self.repository.revision_trees(self.parents))
 
587
        except errors.NoSuchRevision:
 
588
            # one or more ghosts, slow path.
 
589
            revtrees = []
 
590
            for revision_id in self.parents:
 
591
                try:
 
592
                    revtrees.append(self.repository.revision_tree(revision_id))
 
593
                except errors.NoSuchRevision:
 
594
                    if not revtrees:
 
595
                        basis_revision_id = _mod_revision.NULL_REVISION
 
596
                        ghost_basis = True
 
597
                    revtrees.append(self.repository.revision_tree(
 
598
                        _mod_revision.NULL_REVISION))
582
599
        # The basis inventory from a repository 
583
600
        if revtrees:
584
601
            basis_inv = revtrees[0].inventory
586
603
            basis_inv = self.repository.revision_tree(
587
604
                _mod_revision.NULL_REVISION).inventory
588
605
        if len(self.parents) > 0:
589
 
            if basis_revision_id != self.parents[0]:
 
606
            if basis_revision_id != self.parents[0] and not ghost_basis:
590
607
                raise Exception(
591
608
                    "arbitrary basis parents not yet supported with merges")
592
609
            for revtree in revtrees[1:]:
632
649
            # inv delta  change: (file_id, (path_in_source, path_in_target),
633
650
            #   changed_content, versioned, parent, name, kind,
634
651
            #   executable)
635
 
            basis_entry = basis_inv[file_id]
636
 
            change = (file_id,
637
 
                (basis_inv.id2path(file_id), tree.id2path(file_id)),
638
 
                False, (True, True),
639
 
                (basis_entry.parent_id, basis_entry.parent_id),
640
 
                (basis_entry.name, basis_entry.name),
641
 
                (basis_entry.kind, basis_entry.kind),
642
 
                (basis_entry.executable, basis_entry.executable))
643
 
            changes[file_id] = (change, merged_ids[file_id])
 
652
            try:
 
653
                basis_entry = basis_inv[file_id]
 
654
            except errors.NoSuchId:
 
655
                # a change from basis->some_parents but file_id isn't in basis
 
656
                # so was new in the merge, which means it must have changed
 
657
                # from basis -> current, and as it hasn't the add was reverted
 
658
                # by the user. So we discard this change.
 
659
                pass
 
660
            else:
 
661
                change = (file_id,
 
662
                    (basis_inv.id2path(file_id), tree.id2path(file_id)),
 
663
                    False, (True, True),
 
664
                    (basis_entry.parent_id, basis_entry.parent_id),
 
665
                    (basis_entry.name, basis_entry.name),
 
666
                    (basis_entry.kind, basis_entry.kind),
 
667
                    (basis_entry.executable, basis_entry.executable))
 
668
                changes[file_id] = (change, merged_ids[file_id])
644
669
        # changes contains tuples with the change and a set of inventory
645
670
        # candidates for the file.
646
671
        # inv delta is: