# HG changeset patch # User Phil Cohen # Date 1513925076 21600 # Node ID 01b084914a60ec8d1e0f85c8bb4ee96fc38d8404 # Parent 8d05705bde0a39c06e8024e87b2e3287bf76576f rebase: don't take out a dirstate guard for in-memory rebase Since IMM doesn't affect the dirstate, it's not needed, and might be faster. Differential Revision: https://phab.mercurial-scm.org/D1745 diff -r 8d05705bde0a -r 01b084914a60 hgext/rebase.py --- a/hgext/rebase.py Fri Dec 22 02:38:08 2017 -0500 +++ b/hgext/rebase.py Fri Dec 22 00:44:36 2017 -0600 @@ -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: