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

lothiraldan (Boris Feld) phabricator at mercurial-scm.org
Thu Jan 18 15:31:46 EST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2a7e777c9eed: write: add the possibility to pass keyword argument from batchget to vfs (authored by lothiraldan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1881?vs=4866&id=4929

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

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

CHANGE DETAILS

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)



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


More information about the Mercurial-devel mailing list