##// END OF EJS Templates
arbitraryfilectx: use our existing helpers for reading and writing files...
Martin von Zweigbergk -
r49521:57604015 default
parent child Browse files
Show More
@@ -20,7 +20,6 b' from .node import ('
20 )
20 )
21 from .pycompat import (
21 from .pycompat import (
22 getattr,
22 getattr,
23 open,
24 )
23 )
25 from . import (
24 from . import (
26 dagop,
25 dagop,
@@ -3129,13 +3128,11 b' class arbitraryfilectx(object):'
3129 return util.readfile(self._path)
3128 return util.readfile(self._path)
3130
3129
3131 def decodeddata(self):
3130 def decodeddata(self):
3132 with open(self._path, b"rb") as f:
3131 return util.readfile(self._path)
3133 return f.read()
3134
3132
3135 def remove(self):
3133 def remove(self):
3136 util.unlink(self._path)
3134 util.unlink(self._path)
3137
3135
3138 def write(self, data, flags, **kwargs):
3136 def write(self, data, flags, **kwargs):
3139 assert not flags
3137 assert not flags
3140 with open(self._path, b"wb") as f:
3138 util.writefile(self._path, data)
3141 f.write(data)
General Comments 0
You need to be logged in to leave comments. Login now