# HG changeset patch # User Kyle Lippincott # Date 1570588530 25200 # Node ID 8197b395710e2814970c59754f6e1c5e70a607e9 # Parent 37af48031d6fe048d3c5b6222acf4e24e1f9421f 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 diff -r 37af48031d6f -r 8197b395710e mercurial/destutil.py --- 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 diff -r 37af48031d6f -r 8197b395710e tests/test-bookmarks-merge.t --- 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] diff -r 37af48031d6f -r 8197b395710e tests/test-merge-closedheads.t --- 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 diff -r 37af48031d6f -r 8197b395710e tests/test-merge-default.t --- 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] diff -r 37af48031d6f -r 8197b395710e tests/test-newbranch.t --- 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: diff -r 37af48031d6f -r 8197b395710e tests/test-rebase-named-branches.t --- 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 diff -r 37af48031d6f -r 8197b395710e tests/test-rebase-parameters.t --- 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