Index: hgext/rebase.py =================================================================== --- hgext/rebase.py +++ hgext/rebase.py @@ -17,6 +17,7 @@ from __future__ import absolute_import import errno +import itertools import os from mercurial.i18n import _ @@ -772,6 +773,12 @@ [rebase] experimental.inmemorywarning = Using experimental in-memory rebase + It will not run if any file paths in the source set match a particular + config:: + + [rebase] + experimental.inmemorydisallowedpaths = Types.php|build.jar + Return Values: Returns 0 on success, 1 if nothing to rebase or there are @@ -907,6 +914,21 @@ why_not_imm=whynotimm) return True + # Check for paths in the rebaseset that are likely to later trigger + # conflicts or a mergedriver run (and thus cause the whole rebase to later + # be restarted). + badpaths = ui.config("rebase", "experimental.inmemorydisallowedpaths") + if badpaths: + badpathsre = util.re.compile(badpaths) + ctxs = [repo[rev] for rev in rebaseset] + paths = set.union(set(ctx.files()) for ctx in ctxs) + for path in paths: + if badpathsre.match(path): + whynotimm = "path matched inmemory_disallowed_paths: %s" % path + 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,