/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: Martin Albisetti
  • Date: 2008-04-08 22:51:37 UTC
  • mfrom: (3346 +trunk)
  • mto: (3350.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 3351.
  • Revision ID: argentina@gmail.com-20080408225137-uynl9dxtsdpi8nl9
Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
4470
4470
    are merged. The user can commit or revert these as they desire.
4471
4471
 
4472
4472
    Pending merges need to be committed or reverted before using switch.
 
4473
 
 
4474
    The path to the branch to switch to can be specified relative to the parent
 
4475
    directory of the current branch. For example, if you are currently in a
 
4476
    checkout of /path/to/branch, specifying 'newbranch' will find a branch at
 
4477
    /path/to/newbranch.
4473
4478
    """
4474
4479
 
4475
4480
    takes_args = ['to_location']
4479
4484
 
4480
4485
    def run(self, to_location, force=False):
4481
4486
        from bzrlib import switch
4482
 
        to_branch = Branch.open(to_location)
4483
4487
        tree_location = '.'
4484
4488
        control_dir = bzrdir.BzrDir.open_containing(tree_location)[0]
 
4489
        try:
 
4490
            to_branch = Branch.open(to_location)
 
4491
        except errors.NotBranchError:
 
4492
            to_branch = Branch.open(
 
4493
                control_dir.open_branch().base + '../' + to_location)
4485
4494
        switch.switch(control_dir, to_branch, force)
4486
4495
        note('Switched to branch: %s',
4487
4496
            urlutils.unescape_for_display(to_branch.base, 'utf-8'))