Patchwork D1814: rebase: add experimental.inmemory.nomergedriver to turn off IMM

login
register
mail settings
Submitter phabricator
Date Jan. 5, 2018, 6:01 p.m.
Message ID <differential-rev-PHID-DREV-bu3rjiej64rhmz5l6qkj-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/26570/
State Superseded
Headers show

Comments

phabricator - Jan. 5, 2018, 6:01 p.m.
phillco created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This gives us an easy way to ensure IMM is disabled automatically if the user configures a
  mergedriver script.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1814

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS




To: phillco, #hg-reviewers
Cc: mercurial-devel
phabricator - Jan. 5, 2018, 6:14 p.m.
durham added inline comments.

INLINE COMMENTS

> rebase.py:812
> +        elif (ui.config('experimental', 'mergedriver') and
> +              ui.configbool('rebase', 'experimental.inmemory.nomergedriver')):
> +            whynotimm = 'mergedriver enabled'

I think we probably want IMM disabled by default if merge drivers are specified.  If the merge-driver does IO during the preprocess step, it could cause problems in an IMM situation. So I don't think we can enable IMM by default in the merge-driver case until merge-driver enforces (or at least documents) that there should be no IO during preprocess.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1814

To: phillco, #hg-reviewers
Cc: durham, mercurial-devel

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -799,6 +799,19 @@ 
         elif repo.currenttransaction() is not None:
             whynotimm = "rebase run inside a transaction"
 
+        # in-memory rebase can be configured not to run if a mergedriver is
+        # configured; this should be used only if the driver's preprocess()
+        # scripts might use the working copy.
+        #
+        # (Note: Even without this config, IMM will still abort if any files are
+        # marked by preprocess() to be driver-resolved; however, sometimes the
+        # preprocess() function itself can't be trusted.)
+        #
+        # TODO(phillco): Replace with decorators on the scripts themselves
+        elif (ui.config('experimental', 'mergedriver') and
+              ui.configbool('rebase', 'experimental.inmemory.nomergedriver')):
+            whynotimm = 'mergedriver enabled'
+
         if whynotimm:
             ui.log("rebase", "disabling IMM because: %s" % whynotimm,
                 why_not_imm=whynotimm)