rebase: use single transaction when running in memory
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 04 Apr 2018 10:32:48 -0700
changeset 37332 b48b7b130d08
parent 37331 c68262401c8c
child 37333 44f3b60deafb
rebase: use single transaction when running in memory rebase.singletransaction make rebase noticeably faster (~20% in a test I just ran). It is not enabled by default because it risks losing information if it aborts (see `hg help rebase`). When running rebase with the experimental in-memory option on, rebase is first attempted in memory, and if any conflicts occur, it restarts, this time writing to disk. Thus, it should be safe to turn on single-transaction mode for the in-memory phase. Differential Revision: https://phab.mercurial-scm.org/D3076
hgext/rebase.py
--- a/hgext/rebase.py	Tue Apr 03 13:16:12 2018 -0700
+++ b/hgext/rebase.py	Wed Apr 04 10:32:48 2018 -0700
@@ -788,7 +788,9 @@
         try:
             # in-memory merge doesn't support conflicts, so if we hit any, abort
             # and re-run as an on-disk merge.
-            return _origrebase(ui, repo, inmemory=inmemory, **opts)
+            overrides = {('rebase', 'singletransaction'): True}
+            with ui.configoverride(overrides, 'rebase'):
+                return _origrebase(ui, repo, inmemory=inmemory, **opts)
         except error.InMemoryMergeConflictsError:
             ui.warn(_('hit merge conflicts; re-running rebase without in-memory'
                       ' merge\n'))