Also add a metrics log that I missed.
Details
Details
Diff Detail
Diff Detail
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| Lint Skipped |
| Unit Tests Skipped |
| self.prepared = True | self.prepared = True | ||||
| def _assignworkingcopy(self): | def _assignworkingcopy(self): | ||||
| if self.inmemory: | if self.inmemory: | ||||
| from mercurial.context import overlayworkingctx | from mercurial.context import overlayworkingctx | ||||
| self.wctx = overlayworkingctx(self.repo) | self.wctx = overlayworkingctx(self.repo) | ||||
| self.repo.ui.debug("rebasing in-memory\n") | self.repo.ui.debug("rebasing in-memory\n") | ||||
| msg = self.repo.ui.config('rebase', 'experimental.inmemorywarning') | |||||
| if msg: | |||||
| self.repo.ui.warn(msg) | |||||
| else: | else: | ||||
| self.wctx = self.repo[None] | self.wctx = self.repo[None] | ||||
| self.repo.ui.debug("rebasing on disk\n") | self.repo.ui.debug("rebasing on disk\n") | ||||
| self.repo.ui.log("rebase", "", rebase_imm_used=self.wctx.isinmemory()) | self.repo.ui.log("rebase", "", rebase_imm_used=self.wctx.isinmemory()) | ||||
| def _performrebase(self, tr): | def _performrebase(self, tr): | ||||
| self._assignworkingcopy() | self._assignworkingcopy() | ||||
| repo, ui = self.repo, self.ui | repo, ui = self.repo, self.ui | ||||
| By default, rebase writes to the working copy, but you can configure it to | By default, rebase writes to the working copy, but you can configure it to | ||||
| run in-memory for for better performance, and to allow it to run if the | run in-memory for for better performance, and to allow it to run if the | ||||
| working copy is dirty:: | working copy is dirty:: | ||||
| [rebase] | [rebase] | ||||
| experimental.inmemory = True | experimental.inmemory = True | ||||
| It will also print a configurable warning:: | |||||
| [rebase] | |||||
| experimental.inmemorywarning = Using experimental in-memory rebase | |||||
| Return Values: | Return Values: | ||||
| Returns 0 on success, 1 if nothing to rebase or there are | Returns 0 on success, 1 if nothing to rebase or there are | ||||
| unresolved conflicts. | unresolved conflicts. | ||||
| """ | """ | ||||
| inmemory = ui.configbool('rebase', 'experimental.inmemory') | inmemory = ui.configbool('rebase', 'experimental.inmemory') | ||||
| if opts.get('continue') or opts.get('abort'): | if opts.get('continue') or opts.get('abort'): | ||||
| # in-memory rebase is not compatible with resuming rebases. | # in-memory rebase is not compatible with resuming rebases. | ||||
| inmemory = False | inmemory = False | ||||
| if inmemory: | if inmemory: | ||||
| try: | try: | ||||
| # in-memory merge doesn't support conflicts, so if we hit any, abort | # in-memory merge doesn't support conflicts, so if we hit any, abort | ||||
| # and re-run as an on-disk merge. | # and re-run as an on-disk merge. | ||||
| return _origrebase(ui, repo, inmemory=inmemory, **opts) | return _origrebase(ui, repo, inmemory=inmemory, **opts) | ||||
| except error.InMemoryMergeConflictsError: | except error.InMemoryMergeConflictsError: | ||||
| ui.warn(_('hit merge conflicts; re-running rebase without in-memory' | ui.warn(_('hit merge conflicts; re-running rebase without in-memory' | ||||
| ' merge\n')) | ' merge\n')) | ||||
| ui.log("rebase", "", rebase_imm_restart=True) | |||||
| _origrebase(ui, repo, **{'abort': True}) | _origrebase(ui, repo, **{'abort': True}) | ||||
| return _origrebase(ui, repo, inmemory=False, **opts) | return _origrebase(ui, repo, inmemory=False, **opts) | ||||
| else: | else: | ||||
| return _origrebase(ui, repo, **opts) | return _origrebase(ui, repo, **opts) | ||||
| def _origrebase(ui, repo, inmemory=False, **opts): | def _origrebase(ui, repo, inmemory=False, **opts): | ||||
| opts = pycompat.byteskwargs(opts) | opts = pycompat.byteskwargs(opts) | ||||
| rbsrt = rebaseruntime(repo, ui, inmemory, opts) | rbsrt = rebaseruntime(repo, ui, inmemory, opts) | ||||