D672: merge: add `ondisk` to merge.update and pass it in largefiles

phillco (Phil Cohen) phabricator at mercurial-scm.org
Mon Sep 11 03:58:27 UTC 2017


phillco created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  If set to false, parts of the merge might be performed in memory.
  
  Largefiles isn't a good candidate for in-memory merge (it uses a custom
  dirstate, matcher, and the files might not fit in memory) so have it always
  run an old-style merge.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/largefiles/overrides.py
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1467,7 +1467,7 @@
 
 def update(repo, node, branchmerge, force, ancestor=None,
            mergeancestor=False, labels=None, matcher=None, mergeforce=False,
-           updatecheck=None):
+           updatecheck=None, ondisk=True):
     """
     Perform a merge between the working directory and the given node
 
@@ -1516,6 +1516,8 @@
     3 = abort: uncommitted changes (checked in commands.py)
 
     Return the same tuple as applyupdates().
+
+    This function might run parts of the merge in memory if ``ondisk=False``.
     """
     # Avoid cycle.
     from . import sparse
diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -1432,7 +1432,9 @@
         lfdirstate.write()
 
         oldstandins = lfutil.getstandinsstate(repo)
-
+        # largefiles is not a good candidate for in-memory merge (large files,
+        # custom dirstate, matcher usage) so always force an on-disk merge.
+        kwargs["ondisk"] = True
         result = orig(repo, node, branchmerge, force, *args, **kwargs)
 
         newstandins = lfutil.getstandinsstate(repo)



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


More information about the Mercurial-devel mailing list