[PATCH 1 of 2 V2] push: hide description about "-f" in the hint to prevent from using it easily

Siddharth Agarwal sid0 at fb.com
Thu Sep 5 01:30:31 CDT 2013


On 09/04/2013 06:27 AM, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1378300768 -32400
> #      Wed Sep 04 22:19:28 2013 +0900
> # Node ID aa8788937c2e5b505b4096f48536249d29499829
> # Parent  73513cb8c379af12f3dfb9ae2dcab864239481ae
> push: hide description about "-f" in the hint to prevent from using it easily
>
> "use push -f to force" in the hint at abortion of "hg push" may cause
> novice users to execute "push -f" easily without understanding about
> problems of multiple branch heads in the repository.
>
> This patch hides description about "-f" in the hint, and leads into
> seeing "hg help push" for detail about pushing multiple heads.
>
> This patch also recommends to ask the management policy of the
> destination repository before using "-f".
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -4648,7 +4648,10 @@
>       only create a new branch without forcing other changes.
>   
>       Use -f/--force to override the default behavior and push all
> -    changesets on all branches.
> +    changesets on all branches. Before using --force, it is
> +    recommended to ask the administrator of the destination repository
> +    for the management policy of it. Pushing multiple heads in
> +    particular is usually a mistake.
>   
>       If -r/--rev is used, the specified revision and all its ancestors
>       will be pushed to the remote repository.
> diff --git a/mercurial/discovery.py b/mercurial/discovery.py
> --- a/mercurial/discovery.py
> +++ b/mercurial/discovery.py
> @@ -322,11 +322,13 @@
>                       error = _("push creates new remote head %s!"
>                                 ) % short(dhs[0])
>                   if heads[2]: # unsynced
> -                    hint = _("you should pull and merge or "
> -                             "use push -f to force")
> +                    hint = _("you should pull and merge or"
> +                             " see \"hg help push\" for detail about pushing"

details

Also I vaguely remember mpm saying that the hint line needs to be 80 
characters or less. This pushes it up to 89 characters, and the other 
message is 85. Seems like the note about "pushing multiple heads" is 
unnecessary and you could get away just with saying "you should pull and 
merge or see \"hg help push\"".


More information about the Mercurial-devel mailing list