[PATCH 6 of 6] rebase: abort hg pull --rebase if rebase.requiredest is set (issue5514)

Ryan McElroy rm at fb.com
Tue Mar 28 17:31:15 EDT 2017


# HG changeset patch
# User Ryan McElroy <rmcelroy at fb.com>
# Date 1490736063 25200
#      Tue Mar 28 14:21:03 2017 -0700
# Node ID c386f0a4d3c1d95b3b9fc117f20ec1e8939fe557
# Parent  cdf33d63e89377abd6f48ba6d4548a3b3f4af3e2
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.

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1363,6 +1363,11 @@ def pullrebase(orig, ui, repo, *args, **
     '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()
diff --git a/tests/test-rebase-dest.t b/tests/test-rebase-dest.t
--- a/tests/test-rebase-dest.t
+++ b/tests/test-rebase-dest.t
@@ -72,13 +72,7 @@ Check rebase.requiredest interaction wit
   $ 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]
 


More information about the Mercurial-devel mailing list