changeset 31738:ae6bab095c66

rebase: abort hg pull --rebase if rebase.requiredest is set (issue5514) Previously, the pull would succeed, but the subsequent rebase would fail due to the rebase.requiredest flag. Now abort earlier with a more useful error message.
author Ryan McElroy <rmcelroy@fb.com>
date Thu, 30 Mar 2017 03:50:10 -0700
parents 9ddf875183b0
children 44ff5e4ffc8c
files hgext/rebase.py tests/test-rebase-dest.t
diffstat 2 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Thu Mar 30 03:50:10 2017 -0700
+++ b/hgext/rebase.py	Thu Mar 30 03:50:10 2017 -0700
@@ -1362,6 +1362,11 @@
     'Call rebase after pull if the latter has been invoked with --rebase'
     ret = None
     if opts.get('rebase'):
+        if ui.configbool('commands', 'rebase.requiredest'):
+            msg = _('rebase destination required by configuration')
+            hint = _('use hg pull followed by hg rebase -d DEST')
+            raise error.Abort(msg, hint=hint)
+
         wlock = lock = None
         try:
             wlock = repo.wlock()
--- a/tests/test-rebase-dest.t	Thu Mar 30 03:50:10 2017 -0700
+++ b/tests/test-rebase-dest.t	Thu Mar 30 03:50:10 2017 -0700
@@ -72,13 +72,7 @@
   $ echo f > f
   $ hg commit -qAm ff
   $ hg pull --rebase
-  pulling from $TESTTMP/repo
-  searching for changes
-  adding changesets
-  adding manifests
-  adding file changes
-  added 1 changesets with 2 changes to 2 files (+1 heads)
-  abort: you must specify a destination
-  (use: hg rebase -d REV)
+  abort: rebase destination required by configuration
+  (use hg pull followed by hg rebase -d DEST)
   [255]