~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

 * The internal storage of history, and logical branch identity have now
   been split into Branch, and Repository. The common locking and file 
   management routines are now in bzrlib.lockablefiles. 
   (Aaron Bentley, Robert Collins, Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
244
244
        base_tree = branch.working_tree()
245
245
    else:
246
246
        if local_branch is not None:
247
 
            greedy_fetch(local_branch, branch, revision)
248
 
            base_tree = local_branch.revision_tree(revision)
 
247
            if local_branch.base != branch.base:
 
248
                greedy_fetch(local_branch, branch, revision)
 
249
            base_tree = local_branch.repository.revision_tree(revision)
249
250
        else:
250
 
            base_tree = branch.revision_tree(revision)
 
251
            base_tree = branch.repository.revision_tree(revision)
251
252
    return base_tree
252
253
 
253
254
 
389
390
                                                     other_tree)
390
391
 
391
392
    def revision_tree(self, revision_id):
392
 
        return self.this_branch.revision_tree(revision_id)
 
393
        return self.this_branch.repository.revision_tree(revision_id)
393
394
 
394
395
    def ensure_revision_trees(self):
395
396
        if self.this_revision_tree is None:
396
 
            self.this_basis_tree = self.this_branch.revision_tree(
 
397
            self.this_basis_tree = self.this_branch.repository.revision_tree(
397
398
                self.this_basis)
398
399
            if self.this_basis == self.this_rev_id:
399
400
                self.this_revision_tree = self.this_basis_tree
489
490
            return
490
491
        if self.other_rev_id is None:
491
492
            return
492
 
        if self.other_rev_id in self.this_branch.get_ancestry(self.this_basis):
 
493
        ancestry = self.this_branch.repository.get_ancestry(self.this_basis)
 
494
        if self.other_rev_id in ancestry:
493
495
            return
494
496
        self.this_branch.working_tree().add_pending_merge(self.other_rev_id)
495
497
 
509
511
            self.other_basis = other_branch.last_revision()
510
512
            if self.other_basis is None:
511
513
                raise NoCommits(other_branch)
512
 
        fetch(from_branch=other_branch, to_branch=self.this_branch, 
513
 
              last_revision=self.other_basis)
 
514
        if other_branch.base != self.this_branch.base:
 
515
            fetch(from_branch=other_branch, to_branch=self.this_branch, 
 
516
                  last_revision=self.other_basis)
514
517
 
515
518
    def set_base(self, base_revision):
516
519
        mutter("doing merge() with no base_revision specified")
518
521
            try:
519
522
                self.base_rev_id = common_ancestor(self.this_basis, 
520
523
                                                   self.other_basis, 
521
 
                                                   self.this_branch)
 
524
                                                   self.this_branch.repository)
522
525
            except NoCommonAncestor:
523
526
                raise UnrelatedBranches()
524
527
            self.base_tree = get_revid_tree(self.this_branch, self.base_rev_id,