diff mercurial/destutil.py @ 28189:fac3a24be50e

rebase: choose default destination the same way as 'hg merge' (BC) This changeset finally make 'hg rebase' choose its default destination using the same logic as 'hg merge'. The previous default was "tipmost changeset on the current branch", the new default is "the other head if there is only one". This change has multiple consequences: - Multiple tests which were not rebasing anything (rebasing from tipmost head) are now rebasing on the other "lower" branch. This is the expected new behavior. - A test is now explicitly aborting when there is too many heads on the branch. This is the expected behavior. - We gained a better detection of the "nothing to rebase" case while performing 'hg pull --rebase' so the message have been updated. Making clearer than an update was performed and why. This is beneficial side-effect. - Rebasing from an active bookmark will behave the same as 'hg merge' from a bookmark.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Sun, 14 Feb 2016 13:25:59 +0000
parents 3324345a498e
children 9da2283d0c56
line wrap: on
line diff
--- a/mercurial/destutil.py	Wed Feb 17 20:31:34 2016 +0000
+++ b/mercurial/destutil.py	Sun Feb 14 13:25:59 2016 +0000
@@ -141,6 +141,10 @@
             (_("multiple matching bookmarks to merge -"
                " please merge with an explicit rev or bookmark"),
              _("run 'hg heads' to see all heads")),
+         'rebase':
+            (_("multiple matching bookmarks to rebase -"
+               " please rebase to an explicit rev or bookmark"),
+             _("run 'hg heads' to see all heads")),
         },
     # no other matching divergent bookmark
     'nootherbookmarks':
@@ -148,52 +152,80 @@
             (_("no matching bookmark to merge - "
                "please merge with an explicit rev or bookmark"),
              _("run 'hg heads' to see all heads")),
+         'rebase':
+            (_("no matching bookmark to rebase - "
+               "please rebase to an explicit rev or bookmark"),
+             _("run 'hg heads' to see all heads")),
         },
     # branch have too many unbookmarked heads, no obvious destination
     'toomanyheads':
         {'merge':
             (_("branch '%s' has %d heads - please merge with an explicit rev"),
              _("run 'hg heads .' to see heads")),
+         'rebase':
+            (_("branch '%s' has %d heads - please rebase to an explicit rev"),
+             _("run 'hg heads .' to see heads")),
         },
     # branch have no other unbookmarked heads
     'bookmarkedheads':
         {'merge':
             (_("heads are bookmarked - please merge with an explicit rev"),
              _("run 'hg heads' to see all heads")),
+         'rebase':
+            (_("heads are bookmarked - please rebase to an explicit rev"),
+             _("run 'hg heads' to see all heads")),
         },
     # branch have just a single heads, but there is other branches
     'nootherbranchheads':
         {'merge':
             (_("branch '%s' has one head - please merge with an explicit rev"),
              _("run 'hg heads' to see all heads")),
+         'rebase':
+            (_("branch '%s' has one head - please rebase to an explicit rev"),
+             _("run 'hg heads' to see all heads")),
         },
     # repository have a single head
     'nootherheads':
-            {'merge':
-                (_('nothing to merge'),
-         None),
+        {'merge':
+            (_('nothing to merge'),
+            None),
+         'rebase':
+            (_('nothing to rebase'),
+            None),
         },
     # repository have a single head and we are not on it
     'nootherheadsbehind':
         {'merge':
             (_('nothing to merge'),
              _("use 'hg update' instead")),
+         'rebase':
+            (_('nothing to rebase'),
+             _("use 'hg update' instead")),
         },
     # We are not on a head
     'notatheads':
         {'merge':
             (_('working directory not at a head revision'),
-             _("use 'hg update' or merge with an explicit revision"))
+             _("use 'hg update' or merge with an explicit revision")),
+         'rebase':
+            (_('working directory not at a head revision'),
+             _("use 'hg update' or rebase to an explicit revision"))
         },
     'emptysourceset':
         {'merge':
             (_('source set is empty'),
-             None)
+             None),
+         'rebase':
+            (_('source set is empty'),
+             None),
         },
     'multiplebranchessourceset':
         {'merge':
             (_('source set is rooted in multiple branches'),
-             None)
+             None),
+         'rebase':
+            (_('rebaseset is rooted in multiple named branches'),
+             _('specify an explicit destination with --dest')),
         },
     }