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

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Sept. 4, 2013, 1:27 p.m.
Message ID <aa8788937c2e5b505b40.1378301234@feefifofum>
Download mbox | patch
Permalink /patch/2321/
State Superseded
Commit bfc6ed892349259df809e75ad7493013fcadf7f5
Headers show

Comments

Katsunori FUJIWARA - Sept. 4, 2013, 1:27 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@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".
Siddharth Agarwal - Sept. 5, 2013, 6:30 a.m.
On 09/04/2013 06:27 AM, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@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\"".
Matt Mackall - Sept. 18, 2013, 11:42 p.m.
On Wed, 2013-09-04 at 22:27 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@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".

Looks like there's some good ideas in here.

> 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.

Let's make this its own patch (so we can bikeshed it separately). I
think we should definitely say that using --force is probably a mistake,
but the 'ideal' Mercurial environment doesn't have admins to consult.

>    abort: push creates new remote head c922c0139ca0!
> -  (did you forget to merge? use push -f to force)
> +  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)

Length problem. How about:

(did you forget to merge? see "hg help push" for more details)

> -  (you should pull and merge or use push -f to force)
> +  (you should pull and merge or see "hg help push" for detail about pushing multiple heads)

Another length problem. We don't usually use 'you should', so perhaps:

(pull and merge or see "hg help push")
Katsunori FUJIWARA - Sept. 19, 2013, 9:10 a.m.
At Wed, 18 Sep 2013 18:42:16 -0500,
Matt Mackall wrote:
> 
> On Wed, 2013-09-04 at 22:27 +0900, FUJIWARA Katsunori wrote:
> > # HG changeset patch
> > # User FUJIWARA Katsunori <foozy@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".
> 
> Looks like there's some good ideas in here.
> 
> > 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.
> 
> Let's make this its own patch (so we can bikeshed it separately).

OK, I'll split it.


> I think we should definitely say that using --force is probably a
> mistake, but the 'ideal' Mercurial environment doesn't have admins
> to consult.
> 
> >    abort: push creates new remote head c922c0139ca0!
> > -  (did you forget to merge? use push -f to force)
> > +  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
> 
> Length problem. How about:
> 
> (did you forget to merge? see "hg help push" for more details)

At V1 of this series, Angel suggested that the hint should contain
"multiple heads" phrase, and I understood that it would lead users to
read about "multiple heads" topic in online help.

  http://selenic.com/pipermail/mercurial-devel/2013-August/053180.html

Is 'see "hg help push" for more details' enough ? or how about:

    (merge or see "hg help push" for detail about pushing multiple heads)


> > -  (you should pull and merge or use push -f to force)
> > +  (you should pull and merge or see "hg help push" for detail about pushing multiple heads)
> 
> Another length problem. We don't usually use 'you should', so perhaps:
> 
> (pull and merge or see "hg help push")

I kept "you should" phrase just because original has used it. I'll
revise it so.


> -- 
> Mathematics is the supreme nostalgia of our time.
> 
> 
> 

----------------------------------------------------------------------
[FUJIWARA Katsunori]                             foozy@lares.dti.ne.jp

Patch

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"
+                             " multiple heads")
                 else:
-                    hint = _("did you forget to merge? "
-                             "use push -f to force")
+                    hint = _("did you forget to merge?"
+                             " see \"hg help push\" for detail about pushing"
+                             " multiple heads")
             if branch is not None:
                 repo.ui.note(_("new remote heads on branch '%s'\n") % branch)
             for h in dhs:
diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -275,7 +275,7 @@ 
   pushing to http://localhost:$HGPORT2/
   searching for changes
   abort: push creates new remote head c922c0139ca0!
-  (did you forget to merge? use push -f to force)
+  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
   [255]
   $ hg -R ../a book
      @                         1:0d2164f0ce0d
@@ -291,7 +291,7 @@ 
   pushing to http://localhost:$HGPORT2/
   searching for changes
   abort: push creates new remote head c922c0139ca0!
-  (did you forget to merge? use push -f to force)
+  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
   [255]
   $ hg -R ../a book
      @                         1:0d2164f0ce0d
diff --git a/tests/test-obsolete-checkheads.t b/tests/test-obsolete-checkheads.t
--- a/tests/test-obsolete-checkheads.t
+++ b/tests/test-obsolete-checkheads.t
@@ -98,7 +98,7 @@ 
   pushing to $TESTTMP/remote (glob)
   searching for changes
   abort: push creates new remote head 71e3228bffe1!
-  (did you forget to merge? use push -f to force)
+  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
   [255]
 
 old head is now public (public remote version)
@@ -127,7 +127,7 @@ 
 #   pushing to $TESTTMP/remote
 #   searching for changes
 #   abort: push creates new remote head 71e3228bffe1!
-#   (did you forget to merge? use push -f to force)
+#   (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
 #   [255]
 
 old head is obsolete but replacement is not pushed
@@ -158,7 +158,7 @@ 
   pushing to $TESTTMP/remote (glob)
   searching for changes
   abort: push creates new remote head d7d41ccbd4de!
-  (did you forget to merge? use push -f to force)
+  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
   [255]
 
 
diff --git a/tests/test-phases-exchange.t b/tests/test-phases-exchange.t
--- a/tests/test-phases-exchange.t
+++ b/tests/test-phases-exchange.t
@@ -844,7 +844,7 @@ 
   pushing to ../mu
   searching for changes
   abort: push creates new remote head 435b5d83910c!
-  (did you forget to merge? use push -f to force)
+  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
   [255]
   $ hg push -fr 435b5d83910c ../mu # because the push will create new visible head
   pushing to ../mu
diff --git a/tests/test-push-warn.t b/tests/test-push-warn.t
--- a/tests/test-push-warn.t
+++ b/tests/test-push-warn.t
@@ -26,7 +26,7 @@ 
   pushing to ../a
   searching for changes
   abort: push creates new remote head 1e108cc5548c!
-  (you should pull and merge or use push -f to force)
+  (you should pull and merge or see "hg help push" for detail about pushing multiple heads)
   [255]
 
   $ hg push --debug ../a
@@ -41,7 +41,7 @@ 
   new remote heads on branch 'default'
   new remote head 1e108cc5548c
   abort: push creates new remote head 1e108cc5548c!
-  (you should pull and merge or use push -f to force)
+  (you should pull and merge or see "hg help push" for detail about pushing multiple heads)
   [255]
 
   $ hg pull ../a
@@ -57,7 +57,7 @@ 
   pushing to ../a
   searching for changes
   abort: push creates new remote head 1e108cc5548c!
-  (did you forget to merge? use push -f to force)
+  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
   [255]
 
   $ hg merge
@@ -110,7 +110,7 @@ 
   pushing to ../c
   searching for changes
   abort: push creates new remote head 6346d66eb9f5!
-  (did you forget to merge? use push -f to force)
+  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
   [255]
 
   $ hg push -r 2 ../c
@@ -123,7 +123,7 @@ 
   pushing to ../c
   searching for changes
   abort: push creates new remote head a5dda829a167!
-  (did you forget to merge? use push -f to force)
+  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
   [255]
 
   $ hg push -v -r 3 -r 4 ../c
@@ -133,7 +133,7 @@ 
   new remote head a5dda829a167
   new remote head ee8fbc7a0295
   abort: push creates new remote head a5dda829a167!
-  (did you forget to merge? use push -f to force)
+  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
   [255]
 
   $ hg push -v -f -r 3 -r 4 ../c
@@ -263,7 +263,7 @@ 
   pushing to ../f
   searching for changes
   abort: push creates new remote head 0b715ef6ff8f on branch 'a'!
-  (did you forget to merge? use push -f to force)
+  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
   [255]
 
 Push replacement head on existing branches:
@@ -386,7 +386,7 @@ 
   pushing to h
   searching for changes
   abort: push creates new remote head 97bd0c84d346!
-  (you should pull and merge or use push -f to force)
+  (you should pull and merge or see "hg help push" for detail about pushing multiple heads)
   [255]
 
 
@@ -458,7 +458,7 @@ 
   pushing to ../l
   searching for changes
   abort: push creates new remote head 451211cc22b0 on branch 'a'!
-  (did you forget to merge? use push -f to force)
+  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
   [255]
 
   $ cd ..
@@ -713,14 +713,14 @@ 
   pushing to inner
   searching for changes
   abort: push creates new remote head 7d0f4fb6cf04 on branch 'A'!
-  (did you forget to merge? use push -f to force)
+  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
   [255]
 
   $ hg push inner -r4 -r5
   pushing to inner
   searching for changes
   abort: push creates new remote head 7d0f4fb6cf04 on branch 'A'!
-  (did you forget to merge? use push -f to force)
+  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
   [255]
 
   $ hg in inner
diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -314,7 +314,7 @@ 
   pushing subrepo s to $TESTTMP/t/s
   searching for changes
   abort: push creates new remote head 12a213df6fa9! (in subrepo s)
-  (did you forget to merge? use push -f to force)
+  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
   [255]
   $ hg push -f
   pushing to $TESTTMP/t (glob)
@@ -711,7 +711,7 @@ 
   $ hg -R repo2 ci -m3
   $ hg -q -R repo2 push
   abort: push creates new remote head cc505f09a8b2! (in subrepo s)
-  (did you forget to merge? use push -f to force)
+  (did you forget to merge? see "hg help push" for detail about pushing multiple heads)
   [255]
   $ hg -R repo update
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved