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

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Jan. 16, 2013, 2:47 p.m.
Message ID <3842a427e56915d1d086.1358347654@feefifofum>
Download mbox | patch
Permalink /patch/654/
State Changes Requested
Headers show

Comments

Katsunori FUJIWARA - Jan. 16, 2013, 2:47 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1358347312 -32400
# Node ID 3842a427e56915d1d08660b86d5cc107ff9e30c9
# Parent  5db16424142c5a52a2fbdcd5db20e8deec355028
push: hide description about "-f" in the hint to prevent from misunderstanding

"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 headed repository.

This patch hides description about "-f" in the hint, and leads into
seeing "hg help push" for detail about forcible pushing instead of it.

This patch also adds detail about --force option into online help of
"hg push".
Angel Ezquerra - Jan. 16, 2013, 3:05 p.m.
On Wed, Jan 16, 2013 at 3:47 PM, FUJIWARA Katsunori
<foozy@lares.dti.ne.jp> wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1358347312 -32400
> # Node ID 3842a427e56915d1d08660b86d5cc107ff9e30c9
> # Parent  5db16424142c5a52a2fbdcd5db20e8deec355028
> push: hide description about "-f" in the hint to prevent from misunderstanding
>
> "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 headed repository.
>
> This patch hides description about "-f" in the hint, and leads into
> seeing "hg help push" for detail about forcible pushing instead of it.
>
> This patch also adds detail about --force option into online help of
> "hg push".
>
> diff -r 5db16424142c -r 3842a427e569 mercurial/commands.py
> --- a/mercurial/commands.py     Wed Jan 09 19:10:44 2013 -0600
> +++ b/mercurial/commands.py     Wed Jan 16 23:41:52 2013 +0900
> @@ -4782,7 +4782,13 @@
>      only create a new branch without forcing other changes.
>
>      Use -f/--force to override the default behavior and push all
> -    changesets on all branches.
> +    specified changesets: by default, all changesets on all branches.
> +    If --force is used, -b/--branch may be useful to prevent from
> +    pushing unexpected heads on other named branches.
> +
> +    You should ask the administrator before pushing with --force,
> +    because it may violate the management policy of the destination
> +    repository. Multiple heads shouldn't be recommended, usually.

To my non native ears, the last sentence feels weird. Instead I'd say:

"It is usually not recommended to have multiple heads on a repository."

or something like that, and perhaps place that sentence before the
"You should ask the aministrator", which I would change to: "You
should change the repository administrator".

That is:

+    It is usually not recommended to have multiple heads on a repository.
+    You should ask the administrator before pushing with --force,
+    because it may violate the management policy of the destination
+    repository.

Angel

Patch

diff -r 5db16424142c -r 3842a427e569 mercurial/commands.py
--- a/mercurial/commands.py	Wed Jan 09 19:10:44 2013 -0600
+++ b/mercurial/commands.py	Wed Jan 16 23:41:52 2013 +0900
@@ -4782,7 +4782,13 @@ 
     only create a new branch without forcing other changes.
 
     Use -f/--force to override the default behavior and push all
-    changesets on all branches.
+    specified changesets: by default, all changesets on all branches.
+    If --force is used, -b/--branch may be useful to prevent from
+    pushing unexpected heads on other named branches.
+
+    You should ask the administrator before pushing with --force,
+    because it may violate the management policy of the destination
+    repository. Multiple heads shouldn't be recommended, usually.
 
     If -r/--rev is used, the specified revision and all its ancestors
     will be pushed to the remote repository.
diff -r 5db16424142c -r 3842a427e569 mercurial/discovery.py
--- a/mercurial/discovery.py	Wed Jan 09 19:10:44 2013 -0600
+++ b/mercurial/discovery.py	Wed Jan 16 23:41:52 2013 +0900
@@ -323,10 +323,10 @@ 
                               ) % short(dhs[0])
                 if heads[2]: # unsynced
                     hint = _("you should pull and merge or "
-                             "use push -f to force")
+                             "see \"hg help push\" about pushing forcibly")
                 else:
                     hint = _("did you forget to merge? "
-                             "use push -f to force")
+                             "see \"hg help push\" about pushing forcibly")
             if branch is not None:
                 repo.ui.note(_("new remote heads on branch '%s'\n") % branch)
             for h in dhs:
diff -r 5db16424142c -r 3842a427e569 tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t	Wed Jan 09 19:10:44 2013 -0600
+++ b/tests/test-bookmarks-pushpull.t	Wed Jan 16 23:41:52 2013 +0900
@@ -230,7 +230,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" about pushing forcibly)
   [255]
   $ hg -R ../a book
      @                         1:0d2164f0ce0d
@@ -246,7 +246,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" about pushing forcibly)
   [255]
   $ hg -R ../a book
      @                         1:0d2164f0ce0d
diff -r 5db16424142c -r 3842a427e569 tests/test-obsolete-checkheads.t
--- a/tests/test-obsolete-checkheads.t	Wed Jan 09 19:10:44 2013 -0600
+++ b/tests/test-obsolete-checkheads.t	Wed Jan 16 23:41:52 2013 +0900
@@ -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" about pushing forcibly)
   [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" about pushing forcibly)
 #   [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" about pushing forcibly)
   [255]
 
 
diff -r 5db16424142c -r 3842a427e569 tests/test-phases-exchange.t
--- a/tests/test-phases-exchange.t	Wed Jan 09 19:10:44 2013 -0600
+++ b/tests/test-phases-exchange.t	Wed Jan 16 23:41:52 2013 +0900
@@ -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" about pushing forcibly)
   [255]
   $ hg push -fr 435b5d83910c ../mu # because the push will create new visible head
   pushing to ../mu
diff -r 5db16424142c -r 3842a427e569 tests/test-push-warn.t
--- a/tests/test-push-warn.t	Wed Jan 09 19:10:44 2013 -0600
+++ b/tests/test-push-warn.t	Wed Jan 16 23:41:52 2013 +0900
@@ -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" about pushing forcibly)
   [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" about pushing forcibly)
   [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" about pushing forcibly)
   [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" about pushing forcibly)
   [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" about pushing forcibly)
   [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" about pushing forcibly)
   [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" about pushing forcibly)
   [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" about pushing forcibly)
   [255]
 
 
@@ -458,7 +458,7 @@ 
   pushing to ../l
   searching for changes
   abort: push creates new remote head e7e31d71180f on branch 'a'!
-  (did you forget to merge? use push -f to force)
+  (did you forget to merge? see "hg help push" about pushing forcibly)
   [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" about pushing forcibly)
   [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" about pushing forcibly)
   [255]
 
   $ hg in inner
diff -r 5db16424142c -r 3842a427e569 tests/test-subrepo.t
--- a/tests/test-subrepo.t	Wed Jan 09 19:10:44 2013 -0600
+++ b/tests/test-subrepo.t	Wed Jan 16 23:41:52 2013 +0900
@@ -321,7 +321,7 @@ 
   pushing subrepo s to $TESTTMP/t/s (glob)
   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" about pushing forcibly)
   [255]
   $ hg push -f
   pushing to $TESTTMP/t (glob)
@@ -588,7 +588,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" about pushing forcibly)
   [255]
   $ hg -R repo update
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved