Mercurial > hg
comparison hgext/rebase.py @ 36975:795eb53f1d3e
rebase: allow in-memory merge of the working copy parent
Before this patch and when the rebase involved the working copy parent
(and thus the working copy too), we would not do in-memory rebase even
if requested to. The in-code comment explains that the reason had
something to do with avoiding an extra update, but I don't know which
update that refers to. Perhaps an earlier version of the code used to
update to the destination before rebasing even if in-memory rebase was
requested? That seems to not be done at least since aa660c1203a9
(rebase: do not bail on uncomitted changes if rebasing in-memory,
2017-12-07).
To see if this still made it slower, I create a single tiny commit on
top of one branch of the mozilla-unified repo (commit a1098c82 to be
exact) and rebased it to another branch (commit d4e9a7be). Before this
patch that took 11.8s and after this patch it took 8.6s (I only did
two runs each, but the timings were very consistent).
Differential Revision: https://phab.mercurial-scm.org/D2876
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 15 Mar 2018 13:19:55 -0700 |
parents | 66651ec259ea |
children | c83e2736c6de |
comparison
equal
deleted
inserted
replaced
36974:435b8b05affd | 36975:795eb53f1d3e |
---|---|
597 # (we do this before stripping) | 597 # (we do this before stripping) |
598 newwd = self.state.get(self.originalwd, self.originalwd) | 598 newwd = self.state.get(self.originalwd, self.originalwd) |
599 if newwd < 0: | 599 if newwd < 0: |
600 # original directory is a parent of rebase set root or ignored | 600 # original directory is a parent of rebase set root or ignored |
601 newwd = self.originalwd | 601 newwd = self.originalwd |
602 if (newwd not in [c.rev() for c in repo[None].parents()] and | 602 if newwd not in [c.rev() for c in repo[None].parents()]: |
603 not self.inmemory): | |
604 ui.note(_("update back to initial working directory parent\n")) | 603 ui.note(_("update back to initial working directory parent\n")) |
605 hg.updaterepo(repo, newwd, False) | 604 hg.updaterepo(repo, newwd, False) |
606 | 605 |
607 collapsedas = None | 606 collapsedas = None |
608 if self.collapsef and not self.keepf: | 607 if self.collapsef and not self.keepf: |
955 'ancestor of destination %s\n') % dest) | 954 'ancestor of destination %s\n') % dest) |
956 else: # can it happen? | 955 else: # can it happen? |
957 ui.status(_('nothing to rebase from %s to %s\n') % | 956 ui.status(_('nothing to rebase from %s to %s\n') % |
958 ('+'.join(bytes(repo[r]) for r in base), dest)) | 957 ('+'.join(bytes(repo[r]) for r in base), dest)) |
959 return None | 958 return None |
960 # If rebasing the working copy parent, force in-memory merge to be off. | 959 |
961 # | |
962 # This is because the extra work of checking out the newly rebased commit | |
963 # outweights the benefits of rebasing in-memory, and executing an extra | |
964 # update command adds a bit of overhead, so better to just do it on disk. In | |
965 # all other cases leave it on. | |
966 # | |
967 # Note that there are cases where this isn't true -- e.g., rebasing large | |
968 # stacks that include the WCP. However, I'm not yet sure where the cutoff | |
969 # is. | |
970 rebasingwcp = repo['.'].rev() in rebaseset | 960 rebasingwcp = repo['.'].rev() in rebaseset |
971 ui.log("rebase", "", rebase_rebasing_wcp=rebasingwcp) | 961 ui.log("rebase", "", rebase_rebasing_wcp=rebasingwcp) |
972 if rbsrt.inmemory and rebasingwcp: | 962 if rbsrt.inmemory and rebasingwcp: |
973 rbsrt.inmemory = False | |
974 # Check these since we did not before. | 963 # Check these since we did not before. |
975 cmdutil.checkunfinished(repo) | 964 cmdutil.checkunfinished(repo) |
976 cmdutil.bailifchanged(repo) | 965 cmdutil.bailifchanged(repo) |
977 | 966 |
978 if not destf: | 967 if not destf: |