~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Robert Collins
  • Date: 2007-04-23 02:29:35 UTC
  • mfrom: (2441 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2442.
  • Revision ID: robertc@robertcollins.net-20070423022935-9hhongamvk6bfdso
Resolve conflicts with bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
        return tree.branch, tree
61
61
    branch = Branch.open_containing(location)[0]
62
62
    if revno == -1:
63
 
        revision = branch.last_revision()
 
63
        revision_id = branch.last_revision()
64
64
    else:
65
 
        revision = branch.get_rev_id(revno)
66
 
        if revision is None:
67
 
            revision = NULL_REVISION
68
 
    return branch, _get_revid_tree(branch, revision, local_branch)
69
 
 
70
 
 
71
 
def _get_revid_tree(branch, revision, local_branch):
72
 
    if revision is None:
 
65
        revision_id = branch.get_rev_id(revno)
 
66
    if revision_id is None:
 
67
        revision_id = NULL_REVISION
 
68
    return branch, _get_revid_tree(branch, revision_id, local_branch)
 
69
 
 
70
 
 
71
def _get_revid_tree(branch, revision_id, local_branch):
 
72
    if revision_id is None:
73
73
        base_tree = branch.bzrdir.open_workingtree()
74
74
    else:
75
75
        if local_branch is not None:
76
76
            if local_branch.base != branch.base:
77
 
                local_branch.fetch(branch, revision)
78
 
            base_tree = local_branch.repository.revision_tree(revision)
 
77
                local_branch.fetch(branch, revision_id)
 
78
            base_tree = local_branch.repository.revision_tree(revision_id)
79
79
        else:
80
 
            base_tree = branch.repository.revision_tree(revision)
 
80
            base_tree = branch.repository.revision_tree(revision_id)
81
81
    return base_tree
82
82
 
83
83
 
 
84
def _get_revid_tree_from_tree(tree, revision_id, local_branch):
 
85
    if revision_id is None:
 
86
        return tree
 
87
    if local_branch is not None:
 
88
        if local_branch.base != tree.branch.base:
 
89
            local_branch.fetch(tree.branch, revision_id)
 
90
        return local_branch.repository.revision_tree(revision_id)
 
91
    return tree.branch.repository.revision_tree(revision_id)
 
92
 
 
93
 
84
94
def transform_tree(from_tree, to_tree, interesting_ids=None):
85
95
    merge_inner(from_tree.branch, to_tree, from_tree, ignore_zero=True,
86
96
                interesting_ids=interesting_ids, this_tree=from_tree)
255
265
                    pb.finished()
256
266
            except NoCommonAncestor:
257
267
                raise UnrelatedBranches()
258
 
            self.base_tree = _get_revid_tree(self.this_branch, self.base_rev_id,
259
 
                                            None)
 
268
            self.base_tree = _get_revid_tree_from_tree(self.this_tree,
 
269
                                                       self.base_rev_id,
 
270
                                                       None)
260
271
            self.base_is_ancestor = True
261
272
        else:
262
273
            base_branch, self.base_tree = _get_tree(base_revision)
1002
1013
                     branch.get_revision_tree(base_revision))'
1003
1014
        """
1004
1015
    if this_tree is None:
1005
 
        warnings.warn("bzrlib.merge.merge_inner requires a this_tree parameter as of "
1006
 
             "bzrlib version 0.8.",
1007
 
             DeprecationWarning,
1008
 
             stacklevel=2)
1009
 
        this_tree = this_branch.bzrdir.open_workingtree()
 
1016
        raise BzrError("bzrlib.merge.merge_inner requires a this_tree "
 
1017
            "parameter as of bzrlib version 0.8.")
1010
1018
    merger = Merger(this_branch, other_tree, base_tree, this_tree=this_tree,
1011
1019
                    pb=pb, change_reporter=change_reporter)
1012
1020
    merger.backup_files = backup_files