~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/switch.py

  • Committer: Martin Pool
  • Date: 2009-06-19 09:06:56 UTC
  • mfrom: (4463 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4464.
  • Revision ID: mbp@sourcefrog.net-20090619090656-d5weqeecyscv8kqp
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from bzrlib.trace import note
23
23
 
24
24
 
25
 
def switch(control_dir, to_branch, force=False, quiet=False):
 
25
def switch(control_dir, to_branch, force=False):
26
26
    """Switch the branch associated with a checkout.
27
27
 
28
28
    :param control_dir: BzrDir of the checkout to change
36
36
        source_repository = to_branch.repository
37
37
    _set_branch_location(control_dir, to_branch, force)
38
38
    tree = control_dir.open_workingtree()
39
 
    _update(tree, source_repository, quiet)
 
39
    _update(tree, source_repository)
40
40
 
41
41
 
42
42
def _check_pending_merges(control, force=False):
118
118
    return False
119
119
 
120
120
 
121
 
def _update(tree, source_repository, quiet=False):
 
121
def _update(tree, source_repository):
122
122
    """Update a working tree to the latest revision of its branch.
123
123
 
124
124
    :param tree: the working tree
128
128
    try:
129
129
        to_branch = tree.branch
130
130
        if tree.last_revision() == to_branch.last_revision():
131
 
            if not quiet:
132
 
                note("Tree is up to date at revision %d.", to_branch.revno())
 
131
            note("Tree is up to date at revision %d.", to_branch.revno())
133
132
            return
134
133
        base_tree = source_repository.revision_tree(tree.last_revision())
135
134
        merge.Merge3Merger(tree, tree, base_tree, to_branch.basis_tree())
136
135
        tree.set_last_revision(to_branch.last_revision())
137
 
        if not quiet:
138
 
            note('Updated to revision %d.' % to_branch.revno())
 
136
        note('Updated to revision %d.' % to_branch.revno())
139
137
    finally:
140
138
        tree.unlock()