Show More
@@ -1310,7 +1310,7 b' class svn_sink(converter_sink, commandli' | |||
|
1310 | 1310 | self.setexec = [] |
|
1311 | 1311 | |
|
1312 | 1312 | fd, messagefile = tempfile.mkstemp(prefix='hg-convert-') |
|
1313 |
fp = os.fdopen(fd, |
|
|
1313 | fp = os.fdopen(fd, r'wb') | |
|
1314 | 1314 | fp.write(util.tonativeeol(commit.desc)) |
|
1315 | 1315 | fp.close() |
|
1316 | 1316 | try: |
@@ -60,11 +60,11 b' class gpg(object):' | |||
|
60 | 60 | try: |
|
61 | 61 | # create temporary files |
|
62 | 62 | fd, sigfile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".sig") |
|
63 |
fp = os.fdopen(fd, |
|
|
63 | fp = os.fdopen(fd, r'wb') | |
|
64 | 64 | fp.write(sig) |
|
65 | 65 | fp.close() |
|
66 | 66 | fd, datafile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".txt") |
|
67 |
fp = os.fdopen(fd, |
|
|
67 | fp = os.fdopen(fd, r'wb') | |
|
68 | 68 | fp.write(data) |
|
69 | 69 | fp.close() |
|
70 | 70 | gpgcmd = ("%s --logger-fd 1 --status-fd 1 --verify " |
@@ -212,7 +212,7 b' class transplanter(object):' | |||
|
212 | 212 | patchfile = None |
|
213 | 213 | else: |
|
214 | 214 | fd, patchfile = tempfile.mkstemp(prefix='hg-transplant-') |
|
215 |
fp = os.fdopen(fd, |
|
|
215 | fp = os.fdopen(fd, r'wb') | |
|
216 | 216 | gen = patch.diff(source, parent, node, opts=diffopts) |
|
217 | 217 | for chunk in gen: |
|
218 | 218 | fp.write(chunk) |
@@ -260,7 +260,7 b' class transplanter(object):' | |||
|
260 | 260 | self.ui.status(_('filtering %s\n') % patchfile) |
|
261 | 261 | user, date, msg = (changelog[1], changelog[2], changelog[4]) |
|
262 | 262 | fd, headerfile = tempfile.mkstemp(prefix='hg-transplant-') |
|
263 |
fp = os.fdopen(fd, |
|
|
263 | fp = os.fdopen(fd, r'wb') | |
|
264 | 264 | fp.write("# HG changeset patch\n") |
|
265 | 265 | fp.write("# User %s\n" % user) |
|
266 | 266 | fp.write("# Date %d %d\n" % date) |
@@ -349,7 +349,7 b' class bundlerepository(localrepo.localre' | |||
|
349 | 349 | suffix=suffix) |
|
350 | 350 | self.tempfile = temp |
|
351 | 351 | |
|
352 |
with os.fdopen(fdtemp, |
|
|
352 | with os.fdopen(fdtemp, r'wb') as fptemp: | |
|
353 | 353 | fptemp.write(header) |
|
354 | 354 | while True: |
|
355 | 355 | chunk = readfn(2**18) |
@@ -75,7 +75,7 b' def writechunks(ui, chunks, filename, vf' | |||
|
75 | 75 | fh = open(filename, "wb", 131072) |
|
76 | 76 | else: |
|
77 | 77 | fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") |
|
78 |
fh = os.fdopen(fd, |
|
|
78 | fh = os.fdopen(fd, r"wb") | |
|
79 | 79 | cleanup = filename |
|
80 | 80 | for c in chunks: |
|
81 | 81 | fh.write(c) |
@@ -296,9 +296,9 b' class channeledsystem(object):' | |||
|
296 | 296 | |
|
297 | 297 | _iochannels = [ |
|
298 | 298 | # server.ch, ui.fp, mode |
|
299 |
('cin', 'fin', |
|
|
300 |
('cout', 'fout', |
|
|
301 |
('cerr', 'ferr', |
|
|
299 | ('cin', 'fin', r'rb'), | |
|
300 | ('cout', 'fout', r'wb'), | |
|
301 | ('cerr', 'ferr', r'wb'), | |
|
302 | 302 | ] |
|
303 | 303 | |
|
304 | 304 | class chgcmdserver(commandserver.server): |
@@ -303,8 +303,8 b' def _protectio(ui):' | |||
|
303 | 303 | ui.flush() |
|
304 | 304 | newfiles = [] |
|
305 | 305 | nullfd = os.open(os.devnull, os.O_RDWR) |
|
306 |
for f, sysf, mode in [(ui.fin, util.stdin, |
|
|
307 |
(ui.fout, util.stdout, |
|
|
306 | for f, sysf, mode in [(ui.fin, util.stdin, r'rb'), | |
|
307 | (ui.fout, util.stdout, r'wb')]: | |
|
308 | 308 | if f is sysf: |
|
309 | 309 | newfd = os.dup(f.fileno()) |
|
310 | 310 | os.dup2(nullfd, f.fileno()) |
@@ -1119,7 +1119,7 b' def debuginstall(ui, **opts):' | |||
|
1119 | 1119 | |
|
1120 | 1120 | def writetemp(contents): |
|
1121 | 1121 | (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-") |
|
1122 |
f = os.fdopen(fd, |
|
|
1122 | f = os.fdopen(fd, r"wb") | |
|
1123 | 1123 | f.write(contents) |
|
1124 | 1124 | f.close() |
|
1125 | 1125 | return name |
@@ -674,7 +674,7 b' def _maketempfiles(repo, fco, fca):' | |||
|
674 | 674 | pre = "%s~%s." % (os.path.basename(fullbase), prefix) |
|
675 | 675 | (fd, name) = tempfile.mkstemp(prefix=pre, suffix=ext) |
|
676 | 676 | data = repo.wwritedata(ctx.path(), ctx.data()) |
|
677 |
f = os.fdopen(fd, |
|
|
677 | f = os.fdopen(fd, r"wb") | |
|
678 | 678 | f.write(data) |
|
679 | 679 | f.close() |
|
680 | 680 | return name |
@@ -459,7 +459,7 b' class httppeer(wireproto.wirepeer):' | |||
|
459 | 459 | try: |
|
460 | 460 | # dump bundle to disk |
|
461 | 461 | fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") |
|
462 |
fh = os.fdopen(fd, |
|
|
462 | fh = os.fdopen(fd, r"wb") | |
|
463 | 463 | d = fp.read(4096) |
|
464 | 464 | while d: |
|
465 | 465 | fh.write(d) |
@@ -50,7 +50,7 b' if (pycompat.iswindows' | |||
|
50 | 50 | |
|
51 | 51 | def setdatapath(datapath): |
|
52 | 52 | datapath = pycompat.fsdecode(datapath) |
|
53 |
localedir = os.path.join(datapath, |
|
|
53 | localedir = os.path.join(datapath, r'locale') | |
|
54 | 54 | t = gettextmod.translation(r'hg', localedir, _languages, fallback=True) |
|
55 | 55 | global _ugettext |
|
56 | 56 | try: |
@@ -216,7 +216,7 b' def extract(ui, fileobj):' | |||
|
216 | 216 | |
|
217 | 217 | data = {} |
|
218 | 218 | fd, tmpname = tempfile.mkstemp(prefix='hg-patch-') |
|
219 |
tmpfp = os.fdopen(fd, |
|
|
219 | tmpfp = os.fdopen(fd, r'wb') | |
|
220 | 220 | try: |
|
221 | 221 | msg = pycompat.emailparser().parse(fileobj) |
|
222 | 222 | |
@@ -1106,7 +1106,7 b' the hunk is left unchanged.' | |||
|
1106 | 1106 | ncpatchfp = None |
|
1107 | 1107 | try: |
|
1108 | 1108 | # Write the initial patch |
|
1109 |
f = os.fdopen(patchfd, |
|
|
1109 | f = os.fdopen(patchfd, r"w") | |
|
1110 | 1110 | chunk.header.write(f) |
|
1111 | 1111 | chunk.write(f) |
|
1112 | 1112 | f.write('\n'.join(['# ' + i for i in phelp.splitlines()])) |
@@ -18,7 +18,7 b' class _pycompatstub(object):' | |||
|
18 | 18 | """Add items that will be populated at the first access""" |
|
19 | 19 | items = map(_sysstr, items) |
|
20 | 20 | self._aliases.update( |
|
21 |
(item.replace( |
|
|
21 | (item.replace(r'_', r'').lower(), (origin, item)) | |
|
22 | 22 | for item in items) |
|
23 | 23 | |
|
24 | 24 | def _registeralias(self, origin, attr, name): |
@@ -91,7 +91,7 b' def isatty(fp):' | |||
|
91 | 91 | # destined stdout with a pipe destined stdout (e.g. pager), we want line |
|
92 | 92 | # buffering |
|
93 | 93 | if isatty(stdout): |
|
94 |
stdout = os.fdopen(stdout.fileno(), |
|
|
94 | stdout = os.fdopen(stdout.fileno(), r'wb', 1) | |
|
95 | 95 | |
|
96 | 96 | if pycompat.iswindows: |
|
97 | 97 | from . import windows as platform |
@@ -1251,7 +1251,7 b' def tempfilter(s, cmd):' | |||
|
1251 | 1251 | inname, outname = None, None |
|
1252 | 1252 | try: |
|
1253 | 1253 | infd, inname = tempfile.mkstemp(prefix='hg-filter-in-') |
|
1254 |
fp = os.fdopen(infd, |
|
|
1254 | fp = os.fdopen(infd, r'wb') | |
|
1255 | 1255 | fp.write(s) |
|
1256 | 1256 | fp.close() |
|
1257 | 1257 | outfd, outname = tempfile.mkstemp(prefix='hg-filter-out-') |
@@ -1413,7 +1413,7 b' def hgexecutable():' | |||
|
1413 | 1413 | """ |
|
1414 | 1414 | if _hgexecutable is None: |
|
1415 | 1415 | hg = encoding.environ.get('HG') |
|
1416 |
mainmod = sys.modules[ |
|
|
1416 | mainmod = sys.modules[r'__main__'] | |
|
1417 | 1417 | if hg: |
|
1418 | 1418 | _sethgexecutable(hg) |
|
1419 | 1419 | elif mainfrozen(): |
@@ -1027,7 +1027,7 b' def unbundle(repo, proto, heads):' | |||
|
1027 | 1027 | |
|
1028 | 1028 | # write bundle data to temporary file because it can be big |
|
1029 | 1029 | fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-') |
|
1030 |
fp = os.fdopen(fd, |
|
|
1030 | fp = os.fdopen(fd, r'wb+') | |
|
1031 | 1031 | r = 0 |
|
1032 | 1032 | try: |
|
1033 | 1033 | proto.forwardpayload(fp) |
@@ -176,7 +176,7 b' def _posixworker(ui, func, staticargs, a' | |||
|
176 | 176 | os._exit(ret & 255) |
|
177 | 177 | pids.add(pid) |
|
178 | 178 | os.close(wfd) |
|
179 |
fp = os.fdopen(rfd, |
|
|
179 | fp = os.fdopen(rfd, r'rb', 0) | |
|
180 | 180 | def cleanup(): |
|
181 | 181 | signal.signal(signal.SIGINT, oldhandler) |
|
182 | 182 | waitforworkers() |
General Comments 0
You need to be logged in to leave comments.
Login now