Patchwork D1745: rebase: don't take out a dirstate guard for in-memory rebase

login
register
mail settings
Submitter phabricator
Date Dec. 22, 2017, 4:01 p.m.
Message ID <789999f5d2bf686ae6e81d819c1aa777@localhost.localdomain>
Download mbox | patch
Permalink /patch/26403/
State Not Applicable
Headers show

Comments

phabricator - Dec. 22, 2017, 4:01 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG01b084914a60: rebase: don&#039;t take out a dirstate guard for in-memory rebase (authored by phillco, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1745?vs=4579&id=4580

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS




To: phillco, #hg-reviewers, krbullock
Cc: krbullock, mercurial-devel

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -567,8 +567,6 @@ 
             revtoreuse = max(self.state)
 
             dsguard = None
-            if ui.configbool('rebase', 'singletransaction'):
-                dsguard = dirstateguard.dirstateguard(repo, 'rebase')
             if self.inmemory:
                 newnode = concludememorynode(repo, revtoreuse, p1,
                     self.external,
@@ -578,6 +576,8 @@ 
                     keepbranches=self.keepbranchesf,
                     date=self.date, wctx=self.wctx)
             else:
+                if ui.configbool('rebase', 'singletransaction'):
+                    dsguard = dirstateguard.dirstateguard(repo, 'rebase')
                 with util.acceptintervention(dsguard):
                     newnode = concludenode(repo, revtoreuse, p1, self.external,
                         commitmsg=commitmsg,
@@ -851,8 +851,14 @@ 
         singletr = ui.configbool('rebase', 'singletransaction')
         if singletr:
             tr = repo.transaction('rebase')
+
+        # If `rebase.singletransaction` is enabled, wrap the entire operation in
+        # one transaction here. Otherwise, transactions are obtained when
+        # committing each node, which is slower but allows partial success.
         with util.acceptintervention(tr):
-            if singletr:
+            # Same logic for the dirstate guard, except we don't create one when
+            # rebasing in-memory (it's not needed).
+            if singletr and not inmemory:
                 dsguard = dirstateguard.dirstateguard(repo, 'rebase')
             with util.acceptintervention(dsguard):
                 rbsrt._performrebase(tr)
@@ -1032,8 +1038,8 @@ 
 def concludememorynode(repo, rev, p1, p2, wctx=None,
                        commitmsg=None, editor=None, extrafn=None,
                        keepbranches=False, date=None):
-    '''Commit the wd changes with parents p1 and p2. Reuse commit info from rev
-    but also store useful information in extra.
+    '''Commit the memory changes with parents p1 and p2. Reuse commit info from
+    rev but also store useful information in extra.
     Return node of committed revision.'''
     ctx = repo[rev]
     if commitmsg is None: