~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/merge.py

Updated following j-a-meinel's comments

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
# TODO: build_working_dir can be built on something simpler than merge()
 
18
 
17
19
import os
18
20
 
19
21
import bzrlib
37
39
from bzrlib.revision import is_ancestor, NULL_REVISION
38
40
from bzrlib.trace import mutter, note
39
41
 
40
 
def get_tree(treespec, local_branch=None):
 
42
def _get_tree(treespec, local_branch=None):
41
43
    location, revno = treespec
42
44
    branch = Branch.open_containing(location)[0]
43
45
    if revno is None:
48
50
        revision = branch.get_rev_id(revno)
49
51
        if revision is None:
50
52
            revision = NULL_REVISION
51
 
    return branch, get_revid_tree(branch, revision, local_branch)
 
53
    return branch, _get_revid_tree(branch, revision, local_branch)
52
54
 
53
 
def get_revid_tree(branch, revision, local_branch):
 
55
def _get_revid_tree(branch, revision, local_branch):
54
56
    if revision is None:
55
57
        base_tree = branch.working_tree()
56
58
    else:
62
64
    return base_tree
63
65
 
64
66
 
65
 
def file_exists(tree, file_id):
66
 
    return tree.has_filename(tree.id2path(file_id))
67
 
    
68
 
 
69
67
def build_working_dir(to_dir):
70
68
    """Build a working directory in an empty directory.
71
69
 
218
216
            other_rev_id = other_basis
219
217
            self.other_tree = other_basis_tree
220
218
 
221
 
 
222
219
    def file_revisions(self, file_id):
223
220
        self.ensure_revision_trees()
224
221
        def get_id(tree, file_id):
305
302
        self.this_branch.working_tree().add_pending_merge(self.other_rev_id)
306
303
 
307
304
    def set_other(self, other_revision):
308
 
        other_branch, self.other_tree = get_tree(other_revision, 
309
 
                                                 self.this_branch)
 
305
        other_branch, self.other_tree = _get_tree(other_revision, 
 
306
                                                  self.this_branch)
310
307
        if other_revision[1] == -1:
311
308
            self.other_rev_id = other_branch.last_revision()
312
309
            if self.other_rev_id is None:
332
329
                                                   self.this_branch)
333
330
            except NoCommonAncestor:
334
331
                raise UnrelatedBranches()
335
 
            self.base_tree = get_revid_tree(self.this_branch, self.base_rev_id,
 
332
            self.base_tree = _get_revid_tree(self.this_branch, self.base_rev_id,
336
333
                                            None)
337
334
            self.base_is_ancestor = True
338
335
        else:
339
 
            base_branch, self.base_tree = get_tree(base_revision)
 
336
            base_branch, self.base_tree = _get_tree(base_revision)
340
337
            if base_revision[1] == -1:
341
338
                self.base_rev_id = base_branch.last_revision()
342
339
            elif base_revision[1] is None: