comparison mercurial/commands.py @ 10315:be324d31b6c5 stable

commands: label from user is in local encoding repo.branchtags().keys() are in UTF-8, so the label should be converted to UTF-8 before checking for a naming conflict. Keep the original label for ui.status()
author Steve Borho <steve@borho.org>
date Fri, 05 Feb 2010 04:33:08 -0600
parents acf001ee5ef8
children d117089386e2
comparison
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):