/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/workingtree.py

Merge WorkingTree parent rationalisation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
407
407
                return bzrlib.tree.RevisionTree(self.branch.repository, inv,
408
408
                                                revision_id)
409
409
        # FIXME? RBC 20060403 should we cache the inventory here ?
410
 
        return self.branch.repository.revision_tree(revision_id)
 
410
        try:
 
411
            return self.branch.repository.revision_tree(revision_id)
 
412
        except errors.RevisionNotPresent:
 
413
            # the basis tree *may* be a ghost or a low level error may have
 
414
            # occured. If the revision is present, its a problem, if its not
 
415
            # its a ghost.
 
416
            if self.branch.repository.has_revision(revision_id):
 
417
                raise
 
418
            # the basis tree is a ghost
 
419
            return self.branch.repository.revision_tree(None)
411
420
 
412
421
    @staticmethod
413
422
    @deprecated_method(zero_eight)
674
683
        # TODO: Perhaps should check at this point that the
675
684
        # history of the revision is actually present?
676
685
        p = self.pending_merges()
 
686
        existing_parents = self.get_parent_ids()
677
687
        updated = False
678
688
        for rev_id in revision_ids:
679
689
            if rev_id in p:
680
690
                continue
 
691
            if rev_id in existing_parents:
 
692
                continue
681
693
            p.append(rev_id)
682
694
            updated = True
683
695
        if updated:
740
752
 
741
753
    @needs_write_lock
742
754
    def set_pending_merges(self, rev_list):
 
755
        if self.last_revision() is None:
 
756
            new_last_list = rev_list[:1]
 
757
            rev_list = rev_list[1:]
 
758
            if new_last_list:
 
759
                self.set_last_revision(new_last_list[0])
743
760
        self._control_files.put_utf8('pending-merges', '\n'.join(rev_list))
744
761
 
745
762
    @needs_write_lock
1468
1485
        Do a 'normal' merge of the old branch basis if it is relevant.
1469
1486
        """
1470
1487
        old_tip = self.branch.update()
1471
 
        if old_tip is not None:
1472
 
            self.add_pending_merge(old_tip)
1473
 
        self.branch.lock_read()
1474
1488
        try:
1475
1489
            result = 0
1476
1490
            if self.last_revision() != self.branch.last_revision():
1502
1516
                                      this_tree=self)
1503
1517
            return result
1504
1518
        finally:
1505
 
            self.branch.unlock()
 
1519
            if old_tip is not None:
 
1520
                self.add_pending_merge(old_tip)
1506
1521
 
1507
1522
    @needs_write_lock
1508
1523
    def _write_inventory(self, inv):