~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/switch.py

  • Committer: Patch Queue Manager
  • Date: 2012-02-14 18:29:43 UTC
  • mfrom: (6404.6.11 cached-branch-store)
  • Revision ID: pqm@pqm.ubuntu.com-20120214182943-vso6j0mqdnxfkp7s
(vila) Cache the branch config store to avoid useless IOs. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2009, 2010 Canonical Ltd.
 
1
# Copyright (C) 2007, 2009-2012 Canonical Ltd.
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
105
105
                        'Unable to connect to current master branch %(target)s: '
106
106
                        '%(error)s To switch anyway, use --force.') %
107
107
                        e.__dict__)
108
 
            b.set_bound_location(None)
109
 
            b.pull(to_branch, overwrite=True,
110
 
                possible_transports=possible_transports)
111
 
            b.set_bound_location(to_branch.base)
112
 
            b.set_parent(b.get_master_branch().get_parent())
 
108
            b.lock_write()
 
109
            try:
 
110
                b.set_bound_location(None)
 
111
                b.pull(to_branch, overwrite=True,
 
112
                       possible_transports=possible_transports)
 
113
                b.set_bound_location(to_branch.base)
 
114
                b.set_parent(b.get_master_branch().get_parent())
 
115
            finally:
 
116
                b.unlock()
113
117
        else:
114
118
            # If this is a standalone tree and the new branch
115
119
            # is derived from this one, create a lightweight checkout.