Mercurial > hg
diff hgext/rebase.py @ 35290:482614b3802a
rebase: add the --inmemory option flag; assign a wctx object for the rebase
In the future, the --inmemory flag might be deprecated in favor of something more
intelligent (for example, always rebasing in-memory if the working copy parent
isn't in the rebaseset). But we might keep it as a way to explicitly force IMM
on or off.
Differential Revision: https://phab.mercurial-scm.org/D1232
author | Phil Cohen <phillco@fb.com> |
---|---|
date | Thu, 07 Dec 2017 13:25:23 -0800 |
parents | 3398603c5621 |
children | aa660c1203a9 |
line wrap: on
line diff
--- a/hgext/rebase.py Thu Dec 07 13:20:47 2017 -0800 +++ b/hgext/rebase.py Thu Dec 07 13:25:23 2017 -0800 @@ -179,6 +179,7 @@ self.keepopen = opts.get('keepopen', False) self.obsoletenotrebased = {} self.obsoletewithoutsuccessorindestination = set() + self.inmemory = opts.get('inmemory', False) @property def repo(self): @@ -383,6 +384,12 @@ def _performrebase(self, tr): repo, ui = self.repo, self.ui + # Assign a working copy object. + if self.inmemory: + from mercurial.context import overlayworkingctx + self.wctx = overlayworkingctx(self.repo) + else: + self.wctx = self.repo[None] if self.keepbranchesf: # insert _savebranch at the start of extrafns so if # there's a user-provided extrafn it can clobber branch if @@ -608,6 +615,7 @@ ('i', 'interactive', False, _('(DEPRECATED)')), ('t', 'tool', '', _('specify merge tool')), ('c', 'continue', False, _('continue an interrupted rebase')), + ('', 'inmemory', False, _('run rebase in-memory (EXPERIMENTAL)')), ('a', 'abort', False, _('abort an interrupted rebase'))] + cmdutil.formatteropts, _('[-s REV | -b REV] [-d REV] [OPTION]')) @@ -726,6 +734,8 @@ """ opts = pycompat.byteskwargs(opts) + if 'inmemory' not in opts: + opts['inmemory'] = False rbsrt = rebaseruntime(repo, ui, opts) with repo.wlock(), repo.lock():