Patchwork D1881: write: add the possibility to pass keyword argument from batchget to vfs

login
register
mail settings
Submitter phabricator
Date Jan. 18, 2018, 12:39 p.m.
Message ID <differential-rev-PHID-DREV-lgm2s4xc5smsbv4jp3xe-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/26864/
State Superseded
Headers show

Comments

phabricator - Jan. 18, 2018, 12:39 p.m.
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We are gonna pass atomictemp keyword argument from merge.bachget to
  vfs.__call__. Update all the frames to accept **kwargs and pass it to the next
  function.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/context.py
  mercurial/localrepo.py
  mercurial/vfs.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/vfs.py b/mercurial/vfs.py
--- a/mercurial/vfs.py
+++ b/mercurial/vfs.py
@@ -83,8 +83,8 @@ 
         with self(path, mode=mode) as fp:
             return fp.readlines()
 
-    def write(self, path, data, backgroundclose=False):
-        with self(path, 'wb', backgroundclose=backgroundclose) as fp:
+    def write(self, path, data, backgroundclose=False, **kwargs):
+        with self(path, 'wb', backgroundclose=backgroundclose, **kwargs) as fp:
             return fp.write(data)
 
     def writelines(self, path, data, mode='wb', notindexed=False):
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1099,16 +1099,17 @@ 
             data = self.wvfs.read(filename)
         return self._filter(self._encodefilterpats, filename, data)
 
-    def wwrite(self, filename, data, flags, backgroundclose=False):
+    def wwrite(self, filename, data, flags, backgroundclose=False, **kwargs):
         """write ``data`` into ``filename`` in the working directory
 
         This returns length of written (maybe decoded) data.
         """
         data = self._filter(self._decodefilterpats, filename, data)
         if 'l' in flags:
             self.wvfs.symlink(data, filename)
         else:
-            self.wvfs.write(filename, data, backgroundclose=backgroundclose)
+            self.wvfs.write(filename, data, backgroundclose=backgroundclose,
+                            **kwargs)
             if 'x' in flags:
                 self.wvfs.setflags(filename, False, True)
         return len(data)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1962,10 +1962,11 @@ 
         """wraps unlink for a repo's working directory"""
         self._repo.wvfs.unlinkpath(self._path, ignoremissing=ignoremissing)
 
-    def write(self, data, flags, backgroundclose=False):
+    def write(self, data, flags, backgroundclose=False, **kwargs):
         """wraps repo.wwrite"""
         self._repo.wwrite(self._path, data, flags,
-                          backgroundclose=backgroundclose)
+                          backgroundclose=backgroundclose,
+                          **kwargs)
 
     def markcopied(self, src):
         """marks this file a copy of `src`"""
@@ -2149,7 +2150,7 @@ 
                               % (path, path, self.p1(), len(matches),
                                  ', '.join(matches.keys())))
 
-    def write(self, path, data, flags=''):
+    def write(self, path, data, flags='', **kwargs):
         if data is None:
             raise error.ProgrammingError("data must be non-None")
         self._auditconflicts(path)
@@ -2327,8 +2328,8 @@ 
     def setflags(self, islink, isexec):
         return self._parent.setflags(self._path, islink, isexec)
 
-    def write(self, data, flags, backgroundclose=False):
-        return self._parent.write(self._path, data, flags)
+    def write(self, data, flags, backgroundclose=False, **kwargs):
+        return self._parent.write(self._path, data, flags, **kwargs)
 
     def remove(self, ignoremissing=False):
         return self._parent.remove(self._path)
@@ -2574,7 +2575,7 @@ 
         # need to figure out what to do here
         del self._changectx[self._path]
 
-    def write(self, data, flags):
+    def write(self, data, flags, **kwargs):
         """wraps repo.wwrite"""
         self._data = data
 
@@ -2783,7 +2784,7 @@ 
     def remove(self):
         util.unlink(self._path)
 
-    def write(self, data, flags):
+    def write(self, data, flags, **kwargs):
         assert not flags
         with open(self._path, "w") as f:
             f.write(data)