mercurial/commands.py
branchstable
changeset 10315 be324d31b6c5
parent 10269 acf001ee5ef8
child 10316 d117089386e2
equal deleted inserted replaced
10311:7c5eb0988e7a 10315:be324d31b6c5
   424     if opts.get('clean'):
   424     if opts.get('clean'):
   425         label = repo[None].parents()[0].branch()
   425         label = repo[None].parents()[0].branch()
   426         repo.dirstate.setbranch(label)
   426         repo.dirstate.setbranch(label)
   427         ui.status(_('reset working directory to branch %s\n') % label)
   427         ui.status(_('reset working directory to branch %s\n') % label)
   428     elif label:
   428     elif label:
   429         if not opts.get('force') and label in repo.branchtags():
   429         utflabel = encoding.fromlocal(label)
       
   430         if not opts.get('force') and utflabel in repo.branchtags():
   430             if label not in [p.branch() for p in repo.parents()]:
   431             if label not in [p.branch() for p in repo.parents()]:
   431                 raise util.Abort(_('a branch of the same name already exists'
   432                 raise util.Abort(_('a branch of the same name already exists'
   432                                    ' (use --force to override)'))
   433                                    ' (use --force to override)'))
   433         repo.dirstate.setbranch(encoding.fromlocal(label))
   434         repo.dirstate.setbranch(utflabel)
   434         ui.status(_('marked working directory as branch %s\n') % label)
   435         ui.status(_('marked working directory as branch %s\n') % label)
   435     else:
   436     else:
   436         ui.write("%s\n" % encoding.tolocal(repo.dirstate.branch()))
   437         ui.write("%s\n" % encoding.tolocal(repo.dirstate.branch()))
   437 
   438 
   438 def branches(ui, repo, active=False, closed=False):
   439 def branches(ui, repo, active=False, closed=False):