destutil: provide hint on rebase+merge for how to specify destination/rev
authorKyle Lippincott <spectral@google.com>
Tue, 08 Oct 2019 19:35:30 -0700
changeset 43114 8197b395710e
parent 43113 37af48031d6f
child 43115 4aa72cdf616f
destutil: provide hint on rebase+merge for how to specify destination/rev Without a destination specified, rebase and merge attempt to identify a good candidate; this fails if there's too many heads, the heads have a bookmark, or other reasons. Complicating the issue, users may have specified -t, thinking it means target, and are confused when the error message says that they need to specify an explicit rev or explicit destination - they feel like they already have. Differential Revision: https://phab.mercurial-scm.org/D7024
mercurial/destutil.py
tests/test-bookmarks-merge.t
tests/test-merge-closedheads.t
tests/test-merge-default.t
tests/test-newbranch.t
tests/test-rebase-named-branches.t
tests/test-rebase-parameters.t
--- a/mercurial/destutil.py	Tue Oct 08 10:40:36 2019 -0700
+++ b/mercurial/destutil.py	Tue Oct 08 19:35:30 2019 -0700
@@ -182,14 +182,14 @@
                 b"multiple matching bookmarks to merge -"
                 b" please merge with an explicit rev or bookmark"
             ),
-            _(b"run 'hg heads' to see all heads"),
+            _(b"run 'hg heads' to see all heads, specify rev with -r"),
         ),
         b'rebase': (
             _(
                 b"multiple matching bookmarks to rebase -"
                 b" please rebase to an explicit rev or bookmark"
             ),
-            _(b"run 'hg heads' to see all heads"),
+            _(b"run 'hg heads' to see all heads, specify destination with -d"),
         ),
     },
     # no other matching divergent bookmark
@@ -199,47 +199,47 @@
                 b"no matching bookmark to merge - "
                 b"please merge with an explicit rev or bookmark"
             ),
-            _(b"run 'hg heads' to see all heads"),
+            _(b"run 'hg heads' to see all heads, specify rev with -r"),
         ),
         b'rebase': (
             _(
                 b"no matching bookmark to rebase - "
                 b"please rebase to an explicit rev or bookmark"
             ),
-            _(b"run 'hg heads' to see all heads"),
+            _(b"run 'hg heads' to see all heads, specify destination with -d"),
         ),
     },
     # branch have too many unbookmarked heads, no obvious destination
     b'toomanyheads': {
         b'merge': (
             _(b"branch '%s' has %d heads - please merge with an explicit rev"),
-            _(b"run 'hg heads .' to see heads"),
+            _(b"run 'hg heads .' to see heads, specify rev with -r"),
         ),
         b'rebase': (
             _(b"branch '%s' has %d heads - please rebase to an explicit rev"),
-            _(b"run 'hg heads .' to see heads"),
+            _(b"run 'hg heads .' to see heads, specify destination with -d"),
         ),
     },
     # branch have no other unbookmarked heads
     b'bookmarkedheads': {
         b'merge': (
             _(b"heads are bookmarked - please merge with an explicit rev"),
-            _(b"run 'hg heads' to see all heads"),
+            _(b"run 'hg heads' to see all heads, specify rev with -r"),
         ),
         b'rebase': (
             _(b"heads are bookmarked - please rebase to an explicit rev"),
-            _(b"run 'hg heads' to see all heads"),
+            _(b"run 'hg heads' to see all heads, specify destination with -d"),
         ),
     },
     # branch have just a single heads, but there is other branches
     b'nootherbranchheads': {
         b'merge': (
             _(b"branch '%s' has one head - please merge with an explicit rev"),
-            _(b"run 'hg heads' to see all heads"),
+            _(b"run 'hg heads' to see all heads, specify rev with -r"),
         ),
         b'rebase': (
             _(b"branch '%s' has one head - please rebase to an explicit rev"),
-            _(b"run 'hg heads' to see all heads"),
+            _(b"run 'hg heads' to see all heads, specify destination with -d"),
         ),
     },
     # repository have a single head
--- a/tests/test-bookmarks-merge.t	Tue Oct 08 10:40:36 2019 -0700
+++ b/tests/test-bookmarks-merge.t	Tue Oct 08 19:35:30 2019 -0700
@@ -58,7 +58,7 @@
   (leaving bookmark e)
   $ hg merge
   abort: heads are bookmarked - please merge with an explicit rev
-  (run 'hg heads' to see all heads)
+  (run 'hg heads' to see all heads, specify rev with -r)
   [255]
 
 # our revision is bookmarked
@@ -68,7 +68,7 @@
   (activating bookmark e)
   $ hg merge
   abort: no matching bookmark to merge - please merge with an explicit rev or bookmark
-  (run 'hg heads' to see all heads)
+  (run 'hg heads' to see all heads, specify rev with -r)
   [255]
 
 # merge bookmark heads
@@ -148,5 +148,5 @@
   
   $ hg merge
   abort: heads are bookmarked - please merge with an explicit rev
-  (run 'hg heads' to see all heads)
+  (run 'hg heads' to see all heads, specify rev with -r)
   [255]
--- a/tests/test-merge-closedheads.t	Tue Oct 08 10:40:36 2019 -0700
+++ b/tests/test-merge-closedheads.t	Tue Oct 08 19:35:30 2019 -0700
@@ -43,7 +43,7 @@
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg merge
   abort: branch 'default' has 3 heads - please merge with an explicit rev
-  (run 'hg heads .' to see heads)
+  (run 'hg heads .' to see heads, specify rev with -r)
   [255]
 
 close one of the heads
--- a/tests/test-merge-default.t	Tue Oct 08 10:40:36 2019 -0700
+++ b/tests/test-merge-default.t	Tue Oct 08 19:35:30 2019 -0700
@@ -41,7 +41,7 @@
   $ HGMERGE=internal:other; export HGMERGE
   $ hg merge
   abort: branch 'default' has 3 heads - please merge with an explicit rev
-  (run 'hg heads .' to see heads)
+  (run 'hg heads .' to see heads, specify rev with -r)
   [255]
 
 Should succeed:
@@ -117,7 +117,7 @@
 
   $ hg merge
   abort: branch 'foobranch' has one head - please merge with an explicit rev
-  (run 'hg heads' to see all heads)
+  (run 'hg heads' to see all heads, specify rev with -r)
   [255]
 
 
@@ -137,7 +137,7 @@
 
   $ hg log -r '_destmerge()'
   abort: branch 'foobranch' has one head - please merge with an explicit rev
-  (run 'hg heads' to see all heads)
+  (run 'hg heads' to see all heads, specify rev with -r)
   [255]
 
 (on a branch with a two heads)
@@ -171,5 +171,5 @@
 
   $ hg log -r '_destmerge(foobranch)'
   abort: branch 'foobranch' has one head - please merge with an explicit rev
-  (run 'hg heads' to see all heads)
+  (run 'hg heads' to see all heads, specify rev with -r)
   [255]
--- a/tests/test-newbranch.t	Tue Oct 08 10:40:36 2019 -0700
+++ b/tests/test-newbranch.t	Tue Oct 08 19:35:30 2019 -0700
@@ -318,7 +318,7 @@
 
   $ hg merge
   abort: branch 'test' has one head - please merge with an explicit rev
-  (run 'hg heads' to see all heads)
+  (run 'hg heads' to see all heads, specify rev with -r)
   [255]
   $ hg up -C default
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -327,7 +327,7 @@
 
   $ hg merge
   abort: branch 'default' has 3 heads - please merge with an explicit rev
-  (run 'hg heads .' to see heads)
+  (run 'hg heads .' to see heads, specify rev with -r)
   [255]
 
 3 branch heads, explicit merge required:
--- a/tests/test-rebase-named-branches.t	Tue Oct 08 10:40:36 2019 -0700
+++ b/tests/test-rebase-named-branches.t	Tue Oct 08 19:35:30 2019 -0700
@@ -374,7 +374,7 @@
   
   $ hg rebase
   abort: branch 'c' has one head - please rebase to an explicit rev
-  (run 'hg heads' to see all heads)
+  (run 'hg heads' to see all heads, specify destination with -d)
   [255]
   $ hg tglog
   _  4: 8427af5d86f2 'c2 closed' c
--- a/tests/test-rebase-parameters.t	Tue Oct 08 10:40:36 2019 -0700
+++ b/tests/test-rebase-parameters.t	Tue Oct 08 19:35:30 2019 -0700
@@ -85,7 +85,7 @@
 
   $ hg rebase --base 6
   abort: branch 'default' has 3 heads - please rebase to an explicit rev
-  (run 'hg heads .' to see heads)
+  (run 'hg heads .' to see heads, specify destination with -d)
   [255]
 
   $ hg rebase --rev '1 & !1' --dest 8