/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 bzrlib/builtins.py

  • Committer: Robert Collins
  • Date: 2008-03-03 11:35:47 UTC
  • mto: This revision was merged to the branch mainline in revision 3333.
  • Revision ID: robertc@robertcollins.net-20080303113547-h2gg8asygpg60uun
* ``bzr switch`` will attempt to find branches to switch to relative to the
  current branch. E.g. ``bzr switch branchname`` will look for
  ``current_branch/../branchname``. (Robert Collins, Jelmer Vernooij,
  Wouter van Heyst)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4411
4411
    are merged. The user can commit or revert these as they desire.
4412
4412
 
4413
4413
    Pending merges need to be committed or reverted before using switch.
 
4414
 
 
4415
    The path to the branch to switch to can be specified relative to the parent
 
4416
    directory of the current branch. For example, if you are currently in a
 
4417
    checkout of /path/to/branch, specifying 'newbranch' will find a branch at
 
4418
    /path/to/newbranch.
4414
4419
    """
4415
4420
 
4416
4421
    takes_args = ['to_location']
4420
4425
 
4421
4426
    def run(self, to_location, force=False):
4422
4427
        from bzrlib import switch
4423
 
        to_branch = Branch.open(to_location)
4424
4428
        tree_location = '.'
4425
4429
        control_dir = bzrdir.BzrDir.open_containing(tree_location)[0]
 
4430
        try:
 
4431
            to_branch = Branch.open(to_location)
 
4432
        except errors.NotBranchError:
 
4433
            to_branch = Branch.open(
 
4434
                control_dir.open_branch().base + '../' + to_location)
4426
4435
        switch.switch(control_dir, to_branch, force)
4427
4436
        note('Switched to branch: %s',
4428
4437
            urlutils.unescape_for_display(to_branch.base, 'utf-8'))