[PATCH] branch: help misuse of hg branch to switch branches

Martin Geisler mg at lazybytes.net
Sun Jan 24 06:02:04 CST 2010


Yuya Nishihara <yuya at tcha.org> writes:

> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1263304150 -32400
> # Node ID dd3546d401d1c45de1e53a0a06cedb9b160de785
> # Parent  318d58fe4ceb49d30961cf2818df51b7434d8000
> 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.

I like this patch since I think we should put less emphasis on --force
Is anybody against this change?

> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -430,7 +430,7 @@ def branch(ui, repo, label=None, **opts)
>          if not opts.get('force') and label in repo.branchtags():
>              if label not in [p.branch() for p in repo.parents()]:
>                  raise util.Abort(_('a branch of the same name already exists'
> -                                   ' (use --force to override)'))
> +                                   " (use 'hg update' to switch to it)"))
>          repo.dirstate.setbranch(encoding.fromlocal(label))
>          ui.status(_('marked working directory as branch %s\n') % label)
>      else:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100124/b0aca383/attachment.pgp>


More information about the Mercurial-devel mailing list