/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: 2020-04-05 19:11:34 UTC
  • mto: (7490.7.16 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200405191134-0aebh8ikiwygxma5
Populate the .gitignore file.

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):
 
43
           store_uncommitted=False, possible_transports=None):
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
 
            b.lock_write()
152
 
            try:
 
151
            with b.lock_write():
153
152
                b.set_bound_location(None)
154
153
                b.pull(to_branch, overwrite=True,
155
154
                       possible_transports=possible_transports)
156
155
                b.set_bound_location(to_branch.base)
157
156
                b.set_parent(b.get_master_branch().get_parent())
158
 
            finally:
159
 
                b.unlock()
160
157
        else:
161
158
            # If this is a standalone tree and the new branch
162
159
            # is derived from this one, create a lightweight checkout.