Show More
@@ -447,7 +447,7 b' class mapfile(dict):' | |||
|
447 | 447 | if not self.path: |
|
448 | 448 | return |
|
449 | 449 | try: |
|
450 | fp = open(self.path, 'r') | |
|
450 | fp = open(self.path, 'rb') | |
|
451 | 451 | except IOError as err: |
|
452 | 452 | if err.errno != errno.ENOENT: |
|
453 | 453 | raise |
@@ -471,7 +471,7 b' class mapfile(dict):' | |||
|
471 | 471 | def __setitem__(self, key, value): |
|
472 | 472 | if self.fp is None: |
|
473 | 473 | try: |
|
474 | self.fp = open(self.path, 'a') | |
|
474 | self.fp = open(self.path, 'ab') | |
|
475 | 475 | except IOError as err: |
|
476 | 476 | raise error.Abort( |
|
477 | 477 | _('could not open map file %r: %s') % |
@@ -202,7 +202,7 b' class converter(object):' | |||
|
202 | 202 | return {} |
|
203 | 203 | m = {} |
|
204 | 204 | try: |
|
205 | fp = open(path, 'r') | |
|
205 | fp = open(path, 'rb') | |
|
206 | 206 | for i, line in enumerate(util.iterfile(fp)): |
|
207 | 207 | line = line.splitlines()[0].rstrip() |
|
208 | 208 | if not line: |
@@ -407,13 +407,13 b' class converter(object):' | |||
|
407 | 407 | authorfile = self.authorfile |
|
408 | 408 | if authorfile: |
|
409 | 409 | self.ui.status(_('writing author map file %s\n') % authorfile) |
|
410 | ofile = open(authorfile, 'w+') | |
|
410 | ofile = open(authorfile, 'wb+') | |
|
411 | 411 | for author in self.authors: |
|
412 | 412 | ofile.write("%s=%s\n" % (author, self.authors[author])) |
|
413 | 413 | ofile.close() |
|
414 | 414 | |
|
415 | 415 | def readauthormap(self, authorfile): |
|
416 | afile = open(authorfile, 'r') | |
|
416 | afile = open(authorfile, 'rb') | |
|
417 | 417 | for line in afile: |
|
418 | 418 | |
|
419 | 419 | line = line.strip() |
@@ -46,8 +46,8 b' class convert_cvs(converter_source):' | |||
|
46 | 46 | self.tags = {} |
|
47 | 47 | self.lastbranch = {} |
|
48 | 48 | self.socket = None |
|
49 | self.cvsroot = open(os.path.join(cvs, "Root")).read()[:-1] | |
|
50 | self.cvsrepo = open(os.path.join(cvs, "Repository")).read()[:-1] | |
|
49 | self.cvsroot = open(os.path.join(cvs, "Root"), 'rb').read()[:-1] | |
|
50 | self.cvsrepo = open(os.path.join(cvs, "Repository"), 'rb').read()[:-1] | |
|
51 | 51 | self.encoding = encoding.encoding |
|
52 | 52 | |
|
53 | 53 | self._connect() |
@@ -141,7 +141,7 b' class convert_cvs(converter_source):' | |||
|
141 | 141 | passw = "A" |
|
142 | 142 | cvspass = os.path.expanduser("~/.cvspass") |
|
143 | 143 | try: |
|
144 | pf = open(cvspass) | |
|
144 | pf = open(cvspass, 'rb') | |
|
145 | 145 | for line in pf.read().splitlines(): |
|
146 | 146 | part1, part2 = line.split(' ', 1) |
|
147 | 147 | # /1 :pserver:user@example.com:2401/cvsroot/foo |
@@ -132,7 +132,7 b' def createlog(ui, directory=None, root="' | |||
|
132 | 132 | |
|
133 | 133 | # Get the real directory in the repository |
|
134 | 134 | try: |
|
135 | prefix = open(os.path.join('CVS','Repository')).read().strip() | |
|
135 | prefix = open(os.path.join('CVS','Repository'), 'rb').read().strip() | |
|
136 | 136 | directory = prefix |
|
137 | 137 | if prefix == ".": |
|
138 | 138 | prefix = "" |
@@ -144,7 +144,7 b' def createlog(ui, directory=None, root="' | |||
|
144 | 144 | |
|
145 | 145 | # Use the Root file in the sandbox, if it exists |
|
146 | 146 | try: |
|
147 | root = open(os.path.join('CVS','Root')).read().strip() | |
|
147 | root = open(os.path.join('CVS','Root'), 'rb').read().strip() | |
|
148 | 148 | except IOError: |
|
149 | 149 | pass |
|
150 | 150 | |
@@ -177,7 +177,7 b' def createlog(ui, directory=None, root="' | |||
|
177 | 177 | if cache == 'update': |
|
178 | 178 | try: |
|
179 | 179 | ui.note(_('reading cvs log cache %s\n') % cachefile) |
|
180 | oldlog = pickle.load(open(cachefile)) | |
|
180 | oldlog = pickle.load(open(cachefile, 'rb')) | |
|
181 | 181 | for e in oldlog: |
|
182 | 182 | if not (util.safehasattr(e, 'branchpoints') and |
|
183 | 183 | util.safehasattr(e, 'commitid') and |
@@ -486,7 +486,7 b' def createlog(ui, directory=None, root="' | |||
|
486 | 486 | |
|
487 | 487 | # write the new cachefile |
|
488 | 488 | ui.note(_('writing cvs log cache %s\n') % cachefile) |
|
489 | pickle.dump(log, open(cachefile, 'w')) | |
|
489 | pickle.dump(log, open(cachefile, 'wb')) | |
|
490 | 490 | else: |
|
491 | 491 | log = oldlog |
|
492 | 492 |
@@ -71,7 +71,7 b' class filemapper(object):' | |||
|
71 | 71 | (lex.infile, lex.lineno, listname, name)) |
|
72 | 72 | return 1 |
|
73 | 73 | return 0 |
|
74 | lex = shlex.shlex(open(path), path, True) | |
|
74 | lex = shlex.shlex(open(path, 'rb'), path, True) | |
|
75 | 75 | lex.wordchars += '!@#$%^&*()-=+[]{}|;:,./<>?' |
|
76 | 76 | cmd = lex.get_token() |
|
77 | 77 | while cmd: |
@@ -625,7 +625,7 b' class mercurial_source(common.converter_' | |||
|
625 | 625 | |
|
626 | 626 | def converted(self, rev, destrev): |
|
627 | 627 | if self.convertfp is None: |
|
628 | self.convertfp = open(self.repo.vfs.join('shamap'), 'a') | |
|
628 | self.convertfp = open(self.repo.vfs.join('shamap'), 'ab') | |
|
629 | 629 | self.convertfp.write('%s %s\n' % (destrev, rev)) |
|
630 | 630 | self.convertfp.flush() |
|
631 | 631 |
@@ -231,7 +231,7 b' def filecheck(ui, path, proto):' | |||
|
231 | 231 | def httpcheck(ui, path, proto): |
|
232 | 232 | try: |
|
233 | 233 | opener = urlreq.buildopener() |
|
234 | rsp = opener.open('%s://%s/!svn/ver/0/.svn' % (proto, path)) | |
|
234 | rsp = opener.open('%s://%s/!svn/ver/0/.svn' % (proto, path), 'rb') | |
|
235 | 235 | data = rsp.read() |
|
236 | 236 | except urlerr.httperror as inst: |
|
237 | 237 | if inst.code != 404: |
@@ -639,7 +639,7 b' class svn_source(converter_source):' | |||
|
639 | 639 | return |
|
640 | 640 | if self.convertfp is None: |
|
641 | 641 | self.convertfp = open(os.path.join(self.wc, '.svn', 'hg-shamap'), |
|
642 | 'a') | |
|
642 | 'ab') | |
|
643 | 643 | self.convertfp.write('%s %d\n' % (destrev, self.revnum(rev))) |
|
644 | 644 | self.convertfp.flush() |
|
645 | 645 | |
@@ -1158,7 +1158,7 b' class svn_sink(converter_sink, commandli' | |||
|
1158 | 1158 | |
|
1159 | 1159 | if created: |
|
1160 | 1160 | hook = os.path.join(created, 'hooks', 'pre-revprop-change') |
|
1161 | fp = open(hook, 'w') | |
|
1161 | fp = open(hook, 'wb') | |
|
1162 | 1162 | fp.write(pre_revprop_change) |
|
1163 | 1163 | fp.close() |
|
1164 | 1164 | util.setflags(hook, False, True) |
@@ -1308,7 +1308,7 b' class svn_sink(converter_sink, commandli' | |||
|
1308 | 1308 | self.setexec = [] |
|
1309 | 1309 | |
|
1310 | 1310 | fd, messagefile = tempfile.mkstemp(prefix='hg-convert-') |
|
1311 | fp = os.fdopen(fd, pycompat.sysstr('w')) | |
|
1311 | fp = os.fdopen(fd, pycompat.sysstr('wb')) | |
|
1312 | 1312 | fp.write(commit.desc) |
|
1313 | 1313 | fp.close() |
|
1314 | 1314 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now