[Updated] D12090: arbitraryfilectx: use our existing helpers for reading and writing files

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Jan 27 09:37:47 UTC 2022


Closed by commit rHG576040155dba: arbitraryfilectx: use our existing helpers for reading and writing files (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D12090?vs=31985&id=31986

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D12090/new/

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -20,7 +20,6 @@
 )
 from .pycompat import (
     getattr,
-    open,
 )
 from . import (
     dagop,
@@ -3129,13 +3128,11 @@
         return util.readfile(self._path)
 
     def decodeddata(self):
-        with open(self._path, b"rb") as f:
-            return f.read()
+        return util.readfile(self._path)
 
     def remove(self):
         util.unlink(self._path)
 
     def write(self, data, flags, **kwargs):
         assert not flags
-        with open(self._path, b"wb") as f:
-            f.write(data)
+        util.writefile(self._path, data)



To: martinvonz, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220127/ebdbc2ee/attachment-0002.html>


More information about the Mercurial-patches mailing list