~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Robert Collins
  • Date: 2007-06-26 08:52:20 UTC
  • mto: This revision was merged to the branch mainline in revision 2554.
  • Revision ID: robertc@robertcollins.net-20070626085220-iovhwfjflk8vffbh
Add require_api API.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
from bzrlib.merge3 import Merge3
42
42
from bzrlib.osutils import rename, pathjoin
43
43
from progress import DummyProgress, ProgressPhase
44
 
from bzrlib.revision import common_ancestor, is_ancestor, NULL_REVISION
 
44
from bzrlib.revision import (is_ancestor, NULL_REVISION, ensure_null)
45
45
from bzrlib.textfile import check_text_lines
46
46
from bzrlib.trace import mutter, warning, note
47
47
from bzrlib.transform import (TreeTransform, resolve_conflicts, cook_conflicts,
201
201
            return
202
202
        if self.other_rev_id is None:
203
203
            return
204
 
        ancestry = self.this_branch.repository.get_ancestry(self.this_basis)
 
204
        ancestry = set(self.this_branch.repository.get_ancestry(
 
205
            self.this_basis, topo_sorted=False))
205
206
        if self.other_rev_id in ancestry:
206
207
            return
207
208
        self.this_tree.add_parent_tree((self.other_rev_id, self.other_tree))
258
259
                pb = ui.ui_factory.nested_progress_bar()
259
260
                try:
260
261
                    this_repo = self.this_branch.repository
261
 
                    self.base_rev_id = common_ancestor(self.this_basis, 
262
 
                                                       self.other_basis, 
263
 
                                                       this_repo, pb)
 
262
                    graph = this_repo.get_graph()
 
263
                    revisions = [ensure_null(self.this_basis),
 
264
                                 ensure_null(self.other_basis)]
 
265
                    if NULL_REVISION in revisions:
 
266
                        self.base_rev_id = NULL_REVISION
 
267
                    else:
 
268
                        self.base_rev_id = graph.find_unique_lca(*revisions)
 
269
                        if self.base_rev_id == NULL_REVISION:
 
270
                            raise UnrelatedBranches()
264
271
                finally:
265
272
                    pb.finished()
266
273
            except NoCommonAncestor:
870
877
            except KeyError:
871
878
                this_name = other_name = self.tt.final_name(trans_id)
872
879
            other_path = fp.get_path(trans_id)
873
 
            if this_parent is not None:
 
880
            if this_parent is not None and this_name is not None:
874
881
                this_parent_path = \
875
882
                    fp.get_path(self.tt.trans_id_file_id(this_parent))
876
883
                this_path = pathjoin(this_parent_path, this_name)