~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-03-13 13:38:34 UTC
  • mfrom: (2325.3.5 win32)
  • Revision ID: pqm@pqm.ubuntu.com-20070313133834-ff8514538f6b02f7
(John Arbash Meinel) Some small fixes for win32 and dirstate.

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)