Patchwork [5,of,6] workingfilectx: add backgroundclose as a kwarg to write()

login
register
mail settings
Submitter Phillip Cohen
Date June 26, 2017, 5:36 a.m.
Message ID <8ef73d9c80f5be80fbcc.1498455365@phillco-mbp.dhcp.thefacebook.com>
Download mbox | patch
Permalink /patch/21724/
State Accepted
Headers show

Comments

Phillip Cohen - June 26, 2017, 5:36 a.m.
# HG changeset patch
# User Phil Cohen <phillco@fb.com>
# Date 1498455014 25200
#      Sun Jun 25 22:30:14 2017 -0700
# Node ID 8ef73d9c80f5be80fbcce7161295a4d6f1eb96f6
# Parent  6f9cbb96b39bc21c9685573dfd30f782da3d79b4
workingfilectx: add backgroundclose as a kwarg to write()

This is necessary because some callers in merge.py pass backgroundclose=True
when writing.

As with previous changes in this series, this should be a no-op.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1895,9 +1895,10 @@ 
         """wraps unlink for a repo's working directory"""
         self._repo.wvfs.unlinkpath(self._path, ignoremissing=ignoremissing)
 
-    def write(self, data, flags):
+    def write(self, data, flags, backgroundclose=False):
         """wraps repo.wwrite"""
-        self._repo.wwrite(self._path, data, flags)
+        self._repo.wwrite(self._path, data, flags,
+                          backgroundclose=backgroundclose)
 
     def setflags(self, l, x):
         self._repo.wvfs.setflags(self._path, l, x)
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1130,7 +1130,6 @@ 
     """
     verbose = repo.ui.verbose
     fctx = mctx.filectx
-    wwrite = repo.wwrite
     ui = repo.ui
     i = 0
     with repo.wvfs.backgroundclosing(ui, expectedcount=len(actions)):
@@ -1151,7 +1150,7 @@ 
 
             if repo.wvfs.isdir(f) and not repo.wvfs.islink(f):
                 repo.wvfs.removedirs(f)
-            wwrite(f, fctx(f).data(), flags, backgroundclose=True)
+            wctx[f].write(fctx(f).data(), flags, backgroundclose=True)
             if i == 100:
                 yield i, f
                 i = 0