comparison hgext/remotefilelog/basestore.py @ 40614:aa588bf40a08

py3: add b suffix to make sure file is opened in bytes mode Differential Revision: https://phab.mercurial-scm.org/D5263
author Pulkit Goyal <pulkit@yandex-team.ru>
date Tue, 13 Nov 2018 18:08:55 +0300
parents 13d4ad8d7801
children ad21fbcb1ba5
comparison
equal deleted inserted replaced
40613:9769e0f6ffe0 40614:aa588bf40a08
253 repositories that are using it. This is useful later when doing garbage 253 repositories that are using it. This is useful later when doing garbage
254 collection, since it allows us to insecpt the repos to see what nodes 254 collection, since it allows us to insecpt the repos to see what nodes
255 they want to be kept alive in the store. 255 they want to be kept alive in the store.
256 """ 256 """
257 repospath = os.path.join(self._path, "repos") 257 repospath = os.path.join(self._path, "repos")
258 with open(repospath, 'a') as reposfile: 258 with open(repospath, 'ab') as reposfile:
259 reposfile.write(os.path.dirname(path) + "\n") 259 reposfile.write(os.path.dirname(path) + "\n")
260 260
261 repospathstat = os.stat(repospath) 261 repospathstat = os.stat(repospath)
262 if repospathstat.st_uid == self._uid: 262 if repospathstat.st_uid == self._uid:
263 os.chmod(repospath, 0o0664) 263 os.chmod(repospath, 0o0664)
268 268
269 if self._validatedata(data, path): 269 if self._validatedata(data, path):
270 return True 270 return True
271 271
272 if self._validatecachelog: 272 if self._validatecachelog:
273 with open(self._validatecachelog, 'a+') as f: 273 with open(self._validatecachelog, 'ab+') as f:
274 f.write("corrupt %s during %s\n" % (path, action)) 274 f.write("corrupt %s during %s\n" % (path, action))
275 275
276 os.rename(path, path + ".corrupt") 276 os.rename(path, path + ".corrupt")
277 return False 277 return False
278 278