~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-10 00:43:37 UTC
  • mto: This revision was merged to the branch mainline in revision 1926.
  • Revision ID: john@arbash-meinel.com-20060810004337-6aa4d7ea80e85093
Moving everything into a new location so that we can cache more than just revision ids

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
from bzrlib.branch import Branch
24
24
from bzrlib.conflicts import ConflictList, Conflict
25
 
from bzrlib.delta import compare_trees
26
25
from bzrlib.errors import (BzrCommandError,
27
26
                           BzrError,
28
27
                           NoCommonAncestor,
51
50
# TODO: Report back as changes are merged in
52
51
 
53
52
def _get_tree(treespec, local_branch=None):
 
53
    from bzrlib import workingtree
54
54
    location, revno = treespec
 
55
    if revno is None:
 
56
        tree = workingtree.WorkingTree.open_containing(location)[0]
 
57
        return tree.branch, tree
55
58
    branch = Branch.open_containing(location)[0]
56
 
    if revno is None:
57
 
        revision = None
58
 
    elif revno == -1:
 
59
    if revno == -1:
59
60
        revision = branch.last_revision()
60
61
    else:
61
62
        revision = branch.get_rev_id(revno)
116
117
 
117
118
        if self.other_rev_id is None:
118
119
            other_basis_tree = self.revision_tree(self.other_basis)
119
 
            changes = compare_trees(self.other_tree, other_basis_tree)
 
120
            changes = other_basis_tree.changes_from(self.other_tree)
120
121
            if changes.has_changed():
121
122
                raise WorkingTreeNotRevision(self.this_tree)
122
123
            other_rev_id = self.other_basis
145
146
                raise BzrCommandError("Working tree has uncommitted changes.")
146
147
 
147
148
    def compare_basis(self):
148
 
        changes = compare_trees(self.this_tree, 
149
 
                                self.this_tree.basis_tree(), False)
 
149
        changes = self.this_tree.changes_from(self.this_tree.basis_tree())
150
150
        if not changes.has_changed():
151
151
            self.this_rev_id = self.this_basis
152
152
 
518
518
            if file_id not in tree:
519
519
                return (None, None)
520
520
            kind = tree.kind(file_id)
521
 
            if kind == "root_directory":
522
 
                kind = "directory"
523
521
            if kind == "file":
524
522
                contents = tree.get_file_sha1(file_id)
525
523
            elif kind == "symlink":