changeset 46362:24a32dea6955

rebase: add a config knob for forcing in-memory rebasing Use it in a test case where we know the rebase should proceed without incident in-memory, so we can see tracebacks rather than fallbacks. This makes it easier to try and debug when things are broken. Differential Revision: https://phab.mercurial-scm.org/D8623
author Augie Fackler <augie@google.com>
date Thu, 28 May 2020 17:31:41 -0400
parents dfca84970da8
children 63dfaca9087f
files hgext/rebase.py tests/test-copies-in-changeset.t
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Mon May 18 17:29:53 2020 -0400
+++ b/hgext/rebase.py	Thu May 28 17:31:41 2020 -0400
@@ -67,6 +67,14 @@
 
 cmdtable = {}
 command = registrar.command(cmdtable)
+
+configtable = {}
+configitem = registrar.configitem(configtable)
+configitem(
+    b'devel',
+    b'rebase.force-in-memory-merge',
+    default=False,
+)
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
 # be specifying the version(s) of Mercurial they are tested with, or
@@ -1112,6 +1120,8 @@
             with ui.configoverride(overrides, b'rebase'):
                 return _dorebase(ui, repo, action, opts, inmemory=inmemory)
         except error.InMemoryMergeConflictsError:
+            if ui.configbool(b'devel', b'rebase.force-in-memory-merge'):
+                raise
             ui.warn(
                 _(
                     b'hit merge conflicts; re-running rebase without in-memory'
--- a/tests/test-copies-in-changeset.t	Mon May 18 17:29:53 2020 -0400
+++ b/tests/test-copies-in-changeset.t	Thu May 28 17:31:41 2020 -0400
@@ -345,7 +345,10 @@
   $ hg co -q 0
   $ hg mv a b
   $ hg ci -qm 'rename a to b'
-  $ hg rebase -d 1 --config rebase.experimental.inmemory=yes
+Not only do we want this to run in-memory, it shouldn't fall back to
+on-disk merge (no conflicts), so we force it to be in-memory
+with no fallback.
+  $ hg rebase -d 1 --config rebase.experimental.inmemory=yes --config devel.rebase.force-in-memory-merge=yes
   rebasing 2:* tip "rename a to b" (glob)
   merging a and b to b
   saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/*-*-rebase.hg (glob)