Patchwork remotefilelog: fix opening validatecachelog in text mode

login
register
mail settings
Submitter Inada Naoki
Date Jan. 14, 2020, 9:02 a.m.
Message ID <CAEfz+TyqP75f4Xh6kXgY+SLPaCbC2Cx6fyY70qTqzPpTPK-i-g@mail.gmail.com>
Download mbox | patch
Permalink /patch/44478/
State Accepted
Headers show

Comments

Inada Naoki - Jan. 14, 2020, 9:02 a.m.
# HG changeset patch
# User Inada Naoki <songofacandy@gmail.com>
# Date 1578992235 -32400
#      Tue Jan 14 17:57:15 2020 +0900
# Node ID b8231c6f3cdd3dd56eb0b9aa24b70644ec3d0026
# Parent  8e09551206f54bb102cdcbf4c57b0b10284735ce
remotefilelog: fix opening validatecachelog in text mode
Yuya Nishihara - Jan. 17, 2020, 2:34 p.m.
On Tue, 14 Jan 2020 18:02:47 +0900, Inada Naoki wrote:
> # HG changeset patch
> # User Inada Naoki <songofacandy@gmail.com>
> # Date 1578992235 -32400
> #      Tue Jan 14 17:57:15 2020 +0900
> # Node ID b8231c6f3cdd3dd56eb0b9aa24b70644ec3d0026
> # Parent  8e09551206f54bb102cdcbf4c57b0b10284735ce
> remotefilelog: fix opening validatecachelog in text mode

Queued, thanks.

Patch

diff -r 8e09551206f5 -r b8231c6f3cdd hgext/remotefilelog/basestore.py
--- a/hgext/remotefilelog/basestore.py  Sat Jan 11 05:44:58 2020 +0100
+++ b/hgext/remotefilelog/basestore.py  Tue Jan 14 17:57:15 2020 +0900
@@ -225,7 +225,7 @@  class basestore(object):
             data = shallowutil.readfile(filepath)
             if self._validatecache and not self._validatedata(data, filepath):
                 if self._validatecachelog:
-                    with open(self._validatecachelog, b'a+') as f:
+                    with open(self._validatecachelog, b'ab+') as f:
                         f.write(b"corrupt %s during read\n" % filepath)
                 os.rename(filepath, filepath + b".corrupt")
                 raise KeyError(b"corrupt local cache file %s" % filepath)