Mercurial > hg-stable
changeset 30945:82f1ef8b4477
py3: convert the mode argument of os.fdopen to unicodes (2 of 2)
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 13 Feb 2017 22:15:28 +0530 |
parents | 48dea083f66d |
children | 120682fce099 |
files | hgext/convert/subversion.py hgext/gpg.py hgext/transplant.py mercurial/changegroup.py mercurial/pure/osutil.py mercurial/ui.py mercurial/util.py |
diffstat | 7 files changed, 12 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/subversion.py Mon Feb 13 20:06:38 2017 +0530 +++ b/hgext/convert/subversion.py Mon Feb 13 22:15:28 2017 +0530 @@ -1306,7 +1306,7 @@ self.setexec = [] fd, messagefile = tempfile.mkstemp(prefix='hg-convert-') - fp = os.fdopen(fd, 'w') + fp = os.fdopen(fd, pycompat.sysstr('w')) fp.write(commit.desc) fp.close() try:
--- a/hgext/gpg.py Mon Feb 13 20:06:38 2017 +0530 +++ b/hgext/gpg.py Mon Feb 13 22:15:28 2017 +0530 @@ -18,6 +18,7 @@ error, match, node as hgnode, + pycompat, util, ) @@ -44,11 +45,11 @@ try: # create temporary files fd, sigfile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".sig") - fp = os.fdopen(fd, 'wb') + fp = os.fdopen(fd, pycompat.sysstr('wb')) fp.write(sig) fp.close() fd, datafile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".txt") - fp = os.fdopen(fd, 'wb') + fp = os.fdopen(fd, pycompat.sysstr('wb')) fp.write(data) fp.close() gpgcmd = ("%s --logger-fd 1 --status-fd 1 --verify "
--- a/hgext/transplant.py Mon Feb 13 20:06:38 2017 +0530 +++ b/hgext/transplant.py Mon Feb 13 22:15:28 2017 +0530 @@ -28,6 +28,7 @@ merge, node as nodemod, patch, + pycompat, registrar, revlog, revset, @@ -197,7 +198,7 @@ patchfile = None else: fd, patchfile = tempfile.mkstemp(prefix='hg-transplant-') - fp = os.fdopen(fd, 'w') + fp = os.fdopen(fd, pycompat.sysstr('w')) gen = patch.diff(source, parent, node, opts=diffopts) for chunk in gen: fp.write(chunk) @@ -245,7 +246,7 @@ self.ui.status(_('filtering %s\n') % patchfile) user, date, msg = (changelog[1], changelog[2], changelog[4]) fd, headerfile = tempfile.mkstemp(prefix='hg-transplant-') - fp = os.fdopen(fd, 'w') + fp = os.fdopen(fd, pycompat.sysstr('w')) fp.write("# HG changeset patch\n") fp.write("# User %s\n" % user) fp.write("# Date %d %d\n" % date)
--- a/mercurial/changegroup.py Mon Feb 13 20:06:38 2017 +0530 +++ b/mercurial/changegroup.py Mon Feb 13 22:15:28 2017 +0530 @@ -26,6 +26,7 @@ error, mdiff, phases, + pycompat, util, ) @@ -98,7 +99,7 @@ fh = open(filename, "wb", 131072) else: fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") - fh = os.fdopen(fd, "wb") + fh = os.fdopen(fd, pycompat.sysstr("wb")) cleanup = filename for c in chunks: fh.write(c)
--- a/mercurial/pure/osutil.py Mon Feb 13 20:06:38 2017 +0530 +++ b/mercurial/pure/osutil.py Mon Feb 13 22:15:28 2017 +0530 @@ -338,7 +338,7 @@ _kernel32.CloseHandle(fh) _raiseioerror(name) - f = os.fdopen(fd, mode, bufsize) + f = os.fdopen(fd, pycompat.sysstr(mode), bufsize) # unfortunately, f.name is '<fdopen>' at this point -- so we store # the name on this wrapper. We cannot just assign to f.name, # because that attribute is read-only.
--- a/mercurial/ui.py Mon Feb 13 20:06:38 2017 +0530 +++ b/mercurial/ui.py Mon Feb 13 22:15:28 2017 +0530 @@ -1038,7 +1038,7 @@ suffix=extra['suffix'], text=True, dir=rdir) try: - f = os.fdopen(fd, "w") + f = os.fdopen(fd, pycompat.sysstr("w")) f.write(text) f.close()
--- a/mercurial/util.py Mon Feb 13 20:06:38 2017 +0530 +++ b/mercurial/util.py Mon Feb 13 22:15:28 2017 +0530 @@ -809,7 +809,7 @@ inname, outname = None, None try: infd, inname = tempfile.mkstemp(prefix='hg-filter-in-') - fp = os.fdopen(infd, 'wb') + fp = os.fdopen(infd, pycompat.sysstr('wb')) fp.write(s) fp.close() outfd, outname = tempfile.mkstemp(prefix='hg-filter-out-')