~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/switch.py

  • Committer: Aaron Bentley
  • Date: 2012-07-19 16:57:16 UTC
  • mto: This revision was merged to the branch mainline in revision 6540.
  • Revision ID: aaron@aaronbentley.com-20120719165716-b4iupzkb17b9l9wx
Avoid branch write lock to preserve VFS call count.

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
        _set_branch_location(control_dir, to_branch, force)
62
62
    finally:
63
63
        to_branch.unlock()
64
 
    with lock.write_locked(control_dir.open_workingtree()) as tree:
65
 
        _update(tree, source_repository, quiet, revision_id, store_uncommitted)
 
64
    tree = control_dir.open_workingtree()
 
65
    _update(tree, source_repository, quiet, revision_id, store_uncommitted)
66
66
    _run_post_switch_hooks(control_dir, to_branch, force, revision_id)
67
67
 
68
68
def _check_pending_merges(control, force=False):
170
170
    :param source_repository: repository holding the revisions
171
171
    :param restore_uncommitted: restore any uncommitted changes in the branch.
172
172
    """
173
 
    tree.lock_tree_write()
 
173
    if restore_uncommitted:
 
174
        tree.lock_write()
 
175
    else:
 
176
        tree.lock_tree_write()
174
177
    try:
175
178
        to_branch = tree.branch
176
179
        if revision_id is None: