Patchwork D134: rebase: add config to move rebase into a single transaction

login
register
mail settings
Submitter phabricator
Date July 18, 2017, 8:43 p.m.
Message ID <bed0edaa2885549a3b966f5318d91550@localhost.localdomain>
Download mbox | patch
Permalink /patch/22518/
State Not Applicable, archived
Headers show

Comments

phabricator - July 18, 2017, 8:43 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd341677d667d: rebase: add config to move rebase into a single transaction (authored by durham).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D134?vs=273&id=287

REVISION DETAIL
  https://phab.mercurial-scm.org/D134

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS




EMAIL PREFERENCES
  https://phab.mercurial-scm.org/settings/panel/emailpreferences/

To: durham, #hg-reviewers, martinvonz
Cc: martinvonz, mercurial-devel

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -343,7 +343,7 @@ 
         if dest.closesbranch() and not self.keepbranchesf:
             self.ui.status(_('reopening closed branch head %s\n') % dest)
 
-    def _performrebase(self):
+    def _performrebase(self, tr):
         repo, ui, opts = self.repo, self.ui, self.opts
         if self.keepbranchesf:
             # insert _savebranch at the start of extrafns so if
@@ -394,7 +394,7 @@ 
                                              self.state,
                                              self.destancestors,
                                              self.obsoletenotrebased)
-                self.storestatus()
+                self.storestatus(tr=tr)
                 storecollapsemsg(repo, self.collapsemsg)
                 if len(repo[None].parents()) == 2:
                     repo.ui.debug('resuming interrupted rebase\n')
@@ -641,6 +641,15 @@ 
       [commands]
       rebase.requiredest = True
 
+    By default, rebase will close the transaction after each commit. For
+    performance purposes, you can configure rebase to use a single transaction
+    across the entire rebase. WARNING: This setting introduces a significant
+    risk of losing the work you've done in a rebase if the rebase aborts
+    unexpectedly::
+
+      [rebase]
+      singletransaction = True
+
     Return Values:
 
     Returns 0 on success, 1 if nothing to rebase or there are
@@ -700,7 +709,12 @@ 
             if retcode is not None:
                 return retcode
 
-        rbsrt._performrebase()
+        tr = None
+        if ui.configbool('rebase', 'singletransaction'):
+            tr = repo.transaction('rebase')
+        with util.acceptintervention(tr):
+            rbsrt._performrebase(tr)
+
         rbsrt._finishrebase()
 
 def _definesets(ui, repo, destf=None, srcf=None, basef=None, revf=None,