Patchwork D628: merge: flush any deferred writes before, and after, running any workers

login
register
mail settings
Submitter phabricator
Date Sept. 12, 2017, 10:31 p.m.
Message ID <0fa7421e5624241f8961a95ff2e94d83@localhost.localdomain>
Download mbox | patch
Permalink /patch/23819/
State Not Applicable
Headers show

Comments

phabricator - Sept. 12, 2017, 10:31 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb90e5b2a9c82: merge: flush any deferred writes before, and after, running any workers (authored by phillco, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D628?vs=1701&id=1770#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D628?vs=1701&id=1770

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1126,6 +1126,10 @@ 
                            "(consider changing to repo root: %s)\n") %
                          repo.root)
 
+    # It's necessary to flush here in case we're inside a worker fork and will
+    # quit after this function.
+    wctx.flushall()
+
 def batchget(repo, mctx, wctx, actions):
     """apply gets to the working directory
 
@@ -1161,6 +1165,10 @@ 
     if i > 0:
         yield i, f
 
+    # It's necessary to flush here in case we're inside a worker fork and will
+    # quit after this function.
+    wctx.flushall()
+
 def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None):
     """apply the merge action list to the working directory
 
@@ -1229,6 +1237,10 @@ 
         progress(_updating, z, item=item, total=numupdates, unit=_files)
     removed = len(actions['r'])
 
+    # We should flush before forking into worker processes, since those workers
+    # flush when they complete, and we don't want to duplicate work.
+    wctx.flushall()
+
     # get in parallel
     prog = worker.worker(repo.ui, 0.001, batchget, (repo, mctx, wctx),
                          actions['g'])