comparison mercurial/commands.py @ 10596:7648f32713f2 stable

branch: help misuse of hg branch to switch branches Maybe beginners tend to use 'hg branch EXISTING_BRANCH' instead of 'hg update EXISTING_BRANCH' as me. If so, let's help them to use 'update'. Also removed '(use --force to override)' because it can mislead them.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 12 Jan 2010 22:49:10 +0900
parents f142fa3c0a8c
children e764f24a45ee 65b178f30eae
comparison
equal deleted inserted replaced
10595:47f9868d8dcf 10596:7648f32713f2
449 elif label: 449 elif label:
450 utflabel = encoding.fromlocal(label) 450 utflabel = encoding.fromlocal(label)
451 if not opts.get('force') and utflabel in repo.branchtags(): 451 if not opts.get('force') and utflabel in repo.branchtags():
452 if label not in [p.branch() for p in repo.parents()]: 452 if label not in [p.branch() for p in repo.parents()]:
453 raise util.Abort(_('a branch of the same name already exists' 453 raise util.Abort(_('a branch of the same name already exists'
454 ' (use --force to override)')) 454 " (use 'hg update' to switch to it)"))
455 repo.dirstate.setbranch(utflabel) 455 repo.dirstate.setbranch(utflabel)
456 ui.status(_('marked working directory as branch %s\n') % label) 456 ui.status(_('marked working directory as branch %s\n') % label)
457 else: 457 else:
458 ui.write("%s\n" % encoding.tolocal(repo.dirstate.branch())) 458 ui.write("%s\n" % encoding.tolocal(repo.dirstate.branch()))
459 459