~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-10-30 03:56:00 UTC
  • mfrom: (3565.6.13 switch_nick)
  • Revision ID: pqm@pqm.ubuntu.com-20081030035600-ot66vjf0ctaw4guu
(mbp) switch and bind update the branch nick

Show diffs side-by-side

added added

removed removed

Lines of Context:
3786
3786
        except errors.DivergedBranches:
3787
3787
            raise errors.BzrCommandError('These branches have diverged.'
3788
3788
                                         ' Try merging, and then bind again.')
 
3789
        if b.get_config().has_explicit_nickname():
 
3790
            b.nick = b_other.nick
3789
3791
 
3790
3792
 
3791
3793
class cmd_unbind(Command):
4653
4655
    of the new location and binds to it.
4654
4656
    
4655
4657
    In both cases, the working tree is updated and uncommitted changes
4656
 
    are merged. The user can commit or revert these as they desire.
 
4658
    are merged. The user can commit or revert these as they desire. The branch
 
4659
    nickname is also updated to be that of the branch being switched to.
4657
4660
 
4658
4661
    Pending merges need to be committed or reverted before using switch.
4659
4662
 
4672
4675
        from bzrlib import switch
4673
4676
        tree_location = '.'
4674
4677
        control_dir = bzrdir.BzrDir.open_containing(tree_location)[0]
 
4678
        branch = control_dir.open_branch()
4675
4679
        try:
4676
4680
            to_branch = Branch.open(to_location)
4677
4681
        except errors.NotBranchError:
4684
4688
            to_branch = Branch.open(
4685
4689
                urlutils.join(this_url, '..', to_location))
4686
4690
        switch.switch(control_dir, to_branch, force)
 
4691
        if branch.get_config().has_explicit_nickname():
 
4692
            branch = control_dir.open_branch() #get the new branch!
 
4693
            branch.nick = to_branch.nick
4687
4694
        note('Switched to branch: %s',
4688
4695
            urlutils.unescape_for_display(to_branch.base, 'utf-8'))
4689
4696