/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/switch.py

  • Committer: Jelmer Vernooij
  • Date: 2019-06-03 23:48:08 UTC
  • mfrom: (7316 work)
  • mto: This revision was merged to the branch mainline in revision 7328.
  • Revision ID: jelmer@jelmer.uk-20190603234808-15yk5c7054tj8e2b
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 
41
41
 
42
42
def switch(control_dir, to_branch, force=False, quiet=False, revision_id=None,
43
 
           store_uncommitted=False, possible_transports=None):
 
43
           store_uncommitted=False):
44
44
    """Switch the branch associated with a checkout.
45
45
 
46
46
    :param control_dir: ControlDir of the checkout to change
148
148
                    'Unable to connect to current master branch %(target)s: '
149
149
                    '%(error)s To switch anyway, use --force.') %
150
150
                    e.__dict__)
151
 
            with b.lock_write():
 
151
            b.lock_write()
 
152
            try:
152
153
                b.set_bound_location(None)
153
154
                b.pull(to_branch, overwrite=True,
154
155
                       possible_transports=possible_transports)
155
156
                b.set_bound_location(to_branch.base)
156
157
                b.set_parent(b.get_master_branch().get_parent())
 
158
            finally:
 
159
                b.unlock()
157
160
        else:
158
161
            # If this is a standalone tree and the new branch
159
162
            # is derived from this one, create a lightweight checkout.