Patchwork [7,of,7] vfs: drop text mode flag (API)

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 13, 2018, 5:02 a.m.
Message ID <1cd98d602f7a3d4dac3b.1515819778@mimosa>
Download mbox | patch
Permalink /patch/26721/
State Accepted
Headers show

Comments

Yuya Nishihara - Jan. 13, 2018, 5:02 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1515818830 -32400
#      Sat Jan 13 13:47:10 2018 +0900
# Node ID 1cd98d602f7a3d4dac3b1327278a29d50c2c0a3c
# Parent  2a43867d18bbbbdfedd0708a6dfb87ab2fc80e5c
vfs: drop text mode flag (API)

It's useless on Python 3.

.. api::

   ``text=False|True`` option is dropped from the vfs interface because of
   Python 3 compatibility issue. Use ``util.tonativeeol/fromnativeeol()`` to
   convert EOL manually.

Patch

diff --git a/mercurial/vfs.py b/mercurial/vfs.py
--- a/mercurial/vfs.py
+++ b/mercurial/vfs.py
@@ -170,9 +170,9 @@  class abstractvfs(object):
     def mkdir(self, path=None):
         return os.mkdir(self.join(path))
 
-    def mkstemp(self, suffix='', prefix='tmp', dir=None, text=False):
+    def mkstemp(self, suffix='', prefix='tmp', dir=None):
         fd, name = tempfile.mkstemp(suffix=suffix, prefix=prefix,
-                                    dir=self.join(dir), text=text)
+                                    dir=self.join(dir))
         dname, fname = util.split(name)
         if dir:
             return fd, os.path.join(dir, fname)
@@ -333,9 +333,8 @@  class vfs(abstractvfs):
             return
         os.chmod(name, self.createmode & 0o666)
 
-    def __call__(self, path, mode="r", text=False, atomictemp=False,
-                 notindexed=False, backgroundclose=False, checkambig=False,
-                 auditpath=True):
+    def __call__(self, path, mode="r", atomictemp=False, notindexed=False,
+                 backgroundclose=False, checkambig=False, auditpath=True):
         '''Open ``path`` file, which is relative to vfs root.
 
         Newly created directories are marked as "not to be indexed by
@@ -373,7 +372,7 @@  class vfs(abstractvfs):
             self.audit(path, mode=mode)
         f = self.join(path)
 
-        if not text and "b" not in mode:
+        if "b" not in mode:
             mode += "b" # for that other OS
 
         nlink = -1