comparison 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
comparison
equal deleted inserted replaced
35289:2f8c476c49fe 35290:482614b3802a
177 # keepopen is not meant for use on the command line, but by 177 # keepopen is not meant for use on the command line, but by
178 # other extensions 178 # other extensions
179 self.keepopen = opts.get('keepopen', False) 179 self.keepopen = opts.get('keepopen', False)
180 self.obsoletenotrebased = {} 180 self.obsoletenotrebased = {}
181 self.obsoletewithoutsuccessorindestination = set() 181 self.obsoletewithoutsuccessorindestination = set()
182 self.inmemory = opts.get('inmemory', False)
182 183
183 @property 184 @property
184 def repo(self): 185 def repo(self):
185 if self.prepared: 186 if self.prepared:
186 return self._repo.unfiltered() 187 return self._repo.unfiltered()
381 382
382 self.prepared = True 383 self.prepared = True
383 384
384 def _performrebase(self, tr): 385 def _performrebase(self, tr):
385 repo, ui = self.repo, self.ui 386 repo, ui = self.repo, self.ui
387 # Assign a working copy object.
388 if self.inmemory:
389 from mercurial.context import overlayworkingctx
390 self.wctx = overlayworkingctx(self.repo)
391 else:
392 self.wctx = self.repo[None]
386 if self.keepbranchesf: 393 if self.keepbranchesf:
387 # insert _savebranch at the start of extrafns so if 394 # insert _savebranch at the start of extrafns so if
388 # there's a user-provided extrafn it can clobber branch if 395 # there's a user-provided extrafn it can clobber branch if
389 # desired 396 # desired
390 self.extrafns.insert(0, _savebranch) 397 self.extrafns.insert(0, _savebranch)
606 ('', 'keepbranches', False, _('keep original branch names')), 613 ('', 'keepbranches', False, _('keep original branch names')),
607 ('D', 'detach', False, _('(DEPRECATED)')), 614 ('D', 'detach', False, _('(DEPRECATED)')),
608 ('i', 'interactive', False, _('(DEPRECATED)')), 615 ('i', 'interactive', False, _('(DEPRECATED)')),
609 ('t', 'tool', '', _('specify merge tool')), 616 ('t', 'tool', '', _('specify merge tool')),
610 ('c', 'continue', False, _('continue an interrupted rebase')), 617 ('c', 'continue', False, _('continue an interrupted rebase')),
618 ('', 'inmemory', False, _('run rebase in-memory (EXPERIMENTAL)')),
611 ('a', 'abort', False, _('abort an interrupted rebase'))] + 619 ('a', 'abort', False, _('abort an interrupted rebase'))] +
612 cmdutil.formatteropts, 620 cmdutil.formatteropts,
613 _('[-s REV | -b REV] [-d REV] [OPTION]')) 621 _('[-s REV | -b REV] [-d REV] [OPTION]'))
614 def rebase(ui, repo, **opts): 622 def rebase(ui, repo, **opts):
615 """move changeset (and descendants) to a different branch 623 """move changeset (and descendants) to a different branch
724 Returns 0 on success, 1 if nothing to rebase or there are 732 Returns 0 on success, 1 if nothing to rebase or there are
725 unresolved conflicts. 733 unresolved conflicts.
726 734
727 """ 735 """
728 opts = pycompat.byteskwargs(opts) 736 opts = pycompat.byteskwargs(opts)
737 if 'inmemory' not in opts:
738 opts['inmemory'] = False
729 rbsrt = rebaseruntime(repo, ui, opts) 739 rbsrt = rebaseruntime(repo, ui, opts)
730 740
731 with repo.wlock(), repo.lock(): 741 with repo.wlock(), repo.lock():
732 # Validate input and define rebasing points 742 # Validate input and define rebasing points
733 destf = opts.get('dest', None) 743 destf = opts.get('dest', None)