Show More
@@ -10,7 +10,6 import contextlib | |||
|
10 | 10 | import os |
|
11 | 11 | |
|
12 | 12 | from mercurial.i18n import _ |
|
13 | from mercurial.pycompat import open | |
|
14 | 13 | from mercurial import ( |
|
15 | 14 | error, |
|
16 | 15 | extensions, |
@@ -84,7 +83,7 def _getannotate(repo, proto, path, last | |||
|
84 | 83 | for p in [actx.revmappath, actx.linelogpath]: |
|
85 | 84 | if not os.path.exists(p): |
|
86 | 85 | continue |
|
87 |
with open(p, |
|
|
86 | with open(p, 'rb') as f: | |
|
88 | 87 | content = f.read() |
|
89 | 88 | vfsbaselen = len(repo.vfs.base + b'/') |
|
90 | 89 | relpath = p[vfsbaselen:] |
@@ -13,7 +13,6 import os | |||
|
13 | 13 | import struct |
|
14 | 14 | |
|
15 | 15 | from mercurial.node import hex |
|
16 | from mercurial.pycompat import open | |
|
17 | 16 | from mercurial import ( |
|
18 | 17 | error as hgerror, |
|
19 | 18 | ) |
@@ -163,12 +162,12 class revmap: | |||
|
163 | 162 | if not self.path: |
|
164 | 163 | return |
|
165 | 164 | if self._lastmaxrev == -1: # write the entire file |
|
166 |
with open(self.path, |
|
|
165 | with open(self.path, 'wb') as f: | |
|
167 | 166 | f.write(self.HEADER) |
|
168 | 167 | for i in range(1, len(self._rev2hsh)): |
|
169 | 168 | self._writerev(i, f) |
|
170 | 169 | else: # append incrementally |
|
171 |
with open(self.path, |
|
|
170 | with open(self.path, 'ab') as f: | |
|
172 | 171 | for i in range(self._lastmaxrev + 1, len(self._rev2hsh)): |
|
173 | 172 | self._writerev(i, f) |
|
174 | 173 | self._lastmaxrev = self.maxrev |
@@ -181,7 +180,7 class revmap: | |||
|
181 | 180 | # which is faster than both LOAD_CONST and LOAD_GLOBAL. |
|
182 | 181 | flaglen = 1 |
|
183 | 182 | hshlen = _hshlen |
|
184 |
with open(self.path, |
|
|
183 | with open(self.path, 'rb') as f: | |
|
185 | 184 | if f.read(len(self.HEADER)) != self.HEADER: |
|
186 | 185 | raise error.CorruptedFileError() |
|
187 | 186 | self.clear(flush=False) |
@@ -251,7 +250,7 def getlastnode(path): | |||
|
251 | 250 | """ |
|
252 | 251 | hsh = None |
|
253 | 252 | try: |
|
254 |
with open(path, |
|
|
253 | with open(path, 'rb') as f: | |
|
255 | 254 | f.seek(-_hshlen, io.SEEK_END) |
|
256 | 255 | if f.tell() > len(revmap.HEADER): |
|
257 | 256 | hsh = f.read(_hshlen) |
General Comments 0
You need to be logged in to leave comments.
Login now