Index: hgext/rebase.py =================================================================== --- hgext/rebase.py +++ hgext/rebase.py @@ -887,6 +887,28 @@ rbsrt._finishrebase() +def _shoulddisableimm(ui, repo, rebaseset): + """returns if we should disable in-memory merge based on the rebaseset""" + # If rebasing the working copy parent, force in-memory merge to be off. + # + # This is because the extra work of checking out the newly rebased commit + # outweights the benefits of rebasing in-memory, and executing an extra + # update command adds a bit of overhead, so better to just do it on disk. In + # all other cases leave it on. + # + # Note that there are cases where this isn't true -- e.g., rebasing large + # stacks that include the WCP. However, I'm not yet sure where the cutoff + # is. + rebasingwcp = repo['.'].rev() in rebaseset + ui.log("rebase", "", rebase_rebasing_wcp=rebasingwcp) + if rebasingwcp: + whynotimm = "wcp in rebaseset" + ui.log("rebase", "disabling IMM because: %s" % whynotimm, + why_not_imm=whynotimm) + return True + + return False # no change + def _definedestmap(ui, repo, rbsrt, destf=None, srcf=None, basef=None, revf=None, destspace=None): """use revisions argument to define destmap {srcrev: destrev}""" @@ -977,23 +999,10 @@ ui.status(_('nothing to rebase from %s to %s\n') % ('+'.join(str(repo[r]) for r in base), dest)) return None - # If rebasing the working copy parent, force in-memory merge to be off. - # - # This is because the extra work of checking out the newly rebased commit - # outweights the benefits of rebasing in-memory, and executing an extra - # update command adds a bit of overhead, so better to just do it on disk. In - # all other cases leave it on. - # - # Note that there are cases where this isn't true -- e.g., rebasing large - # stacks that include the WCP. However, I'm not yet sure where the cutoff - # is. - rebasingwcp = repo['.'].rev() in rebaseset - ui.log("rebase", "", rebase_rebasing_wcp=rebasingwcp) - if rbsrt.inmemory and rebasingwcp: + + # Possibly disable in-memory merge based on the rebaseset. + if rbsrt.inmemory and _shoulddisableimm(ui, repo, rebaseset): rbsrt.inmemory = False - whynotimm = "wcp in rebaseset" - ui.log("rebase", "disabling IMM because: %s" % whynotimm, - why_not_imm=whynotimm) # Check these since we did not before. cmdutil.checkunfinished(repo)