~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Lalo Martins
  • Date: 2005-09-15 15:16:12 UTC
  • mfrom: (1185.1.18)
  • mto: (1185.1.22)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: lalo@exoweb.net-20050915151611-86c5de4298bb71f9
merging from integration again.

This is a "checkpoint" commit; the tests don't actually pass, but all the
really hard stuff has been merged (in particular, Aaron's new ancestor:
namespace was moved to revisionspec).

Show diffs side-by-side

added added

removed removed

Lines of Context:
596
596
        try:
597
597
            try:
598
598
                return self.revision_store[revision_id]
599
 
            except IndexError:
 
599
            except (IndexError, KeyError):
600
600
                raise bzrlib.errors.NoSuchRevision(self, revision_id)
601
601
        finally:
602
602
            self.unlock()
821
821
 
822
822
        pb = bzrlib.ui.ui_factory.progress_bar()
823
823
        pb.update('comparing histories')
824
 
 
 
824
        if stop_revision is None:
 
825
            other_revision = other.last_patch()
 
826
        else:
 
827
            other_revision = other.get_rev_id(stop_revision)
 
828
        count = greedy_fetch(self, other, other_revision, pb)[0]
825
829
        try:
826
830
            revision_ids = self.missing_revisions(other, stop_revision)
827
831
        except DivergedBranches, e:
828
832
            try:
829
 
                if stop_revision is None:
830
 
                    end_revision = other.last_patch()
831
833
                revision_ids = get_intervening_revisions(self.last_patch(), 
832
 
                                                         end_revision, other)
 
834
                                                         other_revision, self)
833
835
                assert self.last_patch() not in revision_ids
834
836
            except bzrlib.errors.NotAncestor:
835
837
                raise e
836
838
 
837
 
        if len(revision_ids) > 0:
838
 
            count = greedy_fetch(self, other, revision_ids[-1], pb)[0]
839
 
        else:
840
 
            count = 0
841
839
        self.append_revision(*revision_ids)
842
 
        ## note("Added %d revisions." % count)
843
840
        pb.clear()
844
841
 
845
842
    def install_revisions(self, other, revision_ids, pb):
846
843
        if hasattr(other.revision_store, "prefetch"):
847
844
            other.revision_store.prefetch(revision_ids)
848
845
        if hasattr(other.inventory_store, "prefetch"):
849
 
            inventory_ids = [other.get_revision(r).inventory_id
850
 
                             for r in revision_ids]
 
846
            inventory_ids = []
 
847
            for rev_id in revision_ids:
 
848
                try:
 
849
                    revision = other.get_revision(rev_id).inventory_id
 
850
                    inventory_ids.append(revision)
 
851
                except bzrlib.errors.NoSuchRevision:
 
852
                    pass
851
853
            other.inventory_store.prefetch(inventory_ids)
852
854
 
853
855
        if pb is None:
916
918
            raise bzrlib.errors.NoSuchRevision(self, revno)
917
919
        return history[revno - 1]
918
920
 
 
921
 
919
922
    def revision_tree(self, revision_id):
920
923
        """Return Tree for a revision on this branch.
921
924
 
1355
1358
    br_to.update_revisions(branch_from, stop_revision=revno)
1356
1359
    merge((to_location, -1), (to_location, 0), this_dir=to_location,
1357
1360
          check_clean=False, ignore_zero=True)
1358
 
    
1359
1361
    br_to.set_parent(branch_from.base)
 
1362
    return br_to