~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

  • Committer: Alexander Belchenko
  • Date: 2006-07-31 16:12:57 UTC
  • mto: (1711.2.111 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1906.
  • Revision ID: bialix@ukr.net-20060731161257-91a231523255332c
new official bzr.ico

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
# TODO: Report back as changes are merged in
51
51
 
52
52
def _get_tree(treespec, local_branch=None):
53
 
    from bzrlib import workingtree
54
53
    location, revno = treespec
 
54
    branch = Branch.open_containing(location)[0]
55
55
    if revno is None:
56
 
        tree = workingtree.WorkingTree.open_containing(location)[0]
57
 
        return tree.branch, tree
58
 
    branch = Branch.open_containing(location)[0]
59
 
    if revno == -1:
 
56
        revision = None
 
57
    elif revno == -1:
60
58
        revision = branch.last_revision()
61
59
    else:
62
60
        revision = branch.get_rev_id(revno)
183
181
        ancestry = self.this_branch.repository.get_ancestry(self.this_basis)
184
182
        if self.other_rev_id in ancestry:
185
183
            return
186
 
        self.this_tree.add_parent_tree((self.other_rev_id, self.other_tree))
 
184
        self.this_tree.add_pending_merge(self.other_rev_id)
187
185
 
188
186
    def set_other(self, other_revision):
189
 
        """Set the revision and tree to merge from.
190
 
 
191
 
        This sets the other_tree, other_rev_id, other_basis attributes.
192
 
 
193
 
        :param other_revision: The [path, revision] list to merge from.
194
 
        """
195
 
        other_branch, self.other_tree = _get_tree(other_revision,
 
187
        other_branch, self.other_tree = _get_tree(other_revision, 
196
188
                                                  self.this_branch)
197
189
        if other_revision[1] == -1:
198
190
            self.other_rev_id = other_branch.last_revision()
214
206
        self.set_base([None, None])
215
207
 
216
208
    def set_base(self, base_revision):
217
 
        """Set the base revision to use for the merge.
218
 
 
219
 
        :param base_revision: A 2-list containing a path and revision number.
220
 
        """
221
209
        mutter("doing merge() with no base_revision specified")
222
210
        if base_revision == [None, None]:
223
211
            try:
528
516
            if file_id not in tree:
529
517
                return (None, None)
530
518
            kind = tree.kind(file_id)
 
519
            if kind == "root_directory":
 
520
                kind = "directory"
531
521
            if kind == "file":
532
522
                contents = tree.get_file_sha1(file_id)
533
523
            elif kind == "symlink":
923
913
        assert not interesting_ids, ('Only supply interesting_ids'
924
914
                                     ' or interesting_files')
925
915
        merger._set_interesting_files(interesting_files)
926
 
    merger.show_base = show_base
 
916
    merger.show_base = show_base 
927
917
    merger.reprocess = reprocess
928
918
    merger.other_rev_id = other_rev_id
929
919
    merger.other_basis = other_rev_id