~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Aaron Bentley
  • Date: 2007-07-12 18:42:37 UTC
  • mto: This revision was merged to the branch mainline in revision 2617.
  • Revision ID: abentley@panoramicfeedback.com-20070712184237-caa2rq3zhg2949pt
Avoid fetch within a repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
198
198
                raise NoCommits(self.other_branch)
199
199
        if self.other_rev_id is not None:
200
200
            self._cached_trees[self.other_rev_id] = self.other_tree
201
 
        if self.other_branch.base != self.this_branch.base:
202
 
            self.this_branch.fetch(self.other_branch,
203
 
                                   last_revision=self.other_basis)
 
201
        self._maybe_fetch(self.other_branch,self.this_branch, self.other_basis)
204
202
 
205
203
    def set_other_revision(self, revision_id, other_branch):
206
204
        """Set 'other' based on a branch and revision id
210
208
        """
211
209
        self.other_rev_id = revision_id
212
210
        self.other_branch = other_branch
213
 
        self.this_branch.fetch(other_branch, self.other_rev_id)
 
211
        self._maybe_fetch(other_branch, self.this_branch, self.other_rev_id)
214
212
        self.other_tree = self.revision_tree(revision_id)
215
213
        self.other_basis = revision_id
216
214
 
 
215
    def _maybe_fetch(self, source, target, revision_id):
 
216
        if (source.repository.bzrdir.root_transport.base !=
 
217
            target.repository.bzrdir.root_transport.base):
 
218
            target.fetch(source, revision_id)
 
219
 
217
220
    def find_base(self):
218
221
        try:
219
222
            pb = ui.ui_factory.nested_progress_bar()
252
255
                self.base_rev_id = None
253
256
            else:
254
257
                self.base_rev_id = base_branch.get_rev_id(base_revision[1])
255
 
            if self.this_branch.base != base_branch.base:
256
 
                self.this_branch.fetch(base_branch)
 
258
            self._maybe_fetch(base_branch, self.this_branch, self.base_rev_id)
257
259
            self.base_is_ancestor = is_ancestor(self.this_basis, 
258
260
                                                self.base_rev_id,
259
261
                                                self.this_branch)