comparison mercurial/state.py @ 43117:8ff1ecfadcd1

cleanup: join string literals that are already on one line Thanks to Kyle for noticing this and for providing the regular expression to run on the codebase. This patch has been reviewed by the test suite and they approved of it. # skip-blame: fallout from mass reformatting Differential Revision: https://phab.mercurial-scm.org/D7028
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 08 Oct 2019 15:06:18 -0700
parents 687b865b95ad
children 127d46468a45
comparison
equal deleted inserted replaced
43116:defabf63e969 43117:8ff1ecfadcd1
58 58
59 we use third-party library cbor to serialize data to write in the file. 59 we use third-party library cbor to serialize data to write in the file.
60 """ 60 """
61 if not isinstance(version, int): 61 if not isinstance(version, int):
62 raise error.ProgrammingError( 62 raise error.ProgrammingError(
63 b"version of state file should be" b" an integer" 63 b"version of state file should be an integer"
64 ) 64 )
65 65
66 with self._repo.vfs(self.fname, b'wb', atomictemp=True) as fp: 66 with self._repo.vfs(self.fname, b'wb', atomictemp=True) as fp:
67 fp.write(b'%d\n' % version) 67 fp.write(b'%d\n' % version)
68 for chunk in cborutil.streamencode(data): 68 for chunk in cborutil.streamencode(data):
74 with self._repo.vfs(self.fname, b'rb') as fp: 74 with self._repo.vfs(self.fname, b'rb') as fp:
75 try: 75 try:
76 int(fp.readline()) 76 int(fp.readline())
77 except ValueError: 77 except ValueError:
78 raise error.CorruptedState( 78 raise error.CorruptedState(
79 b"unknown version of state file" b" found" 79 b"unknown version of state file found"
80 ) 80 )
81 81
82 return cborutil.decodeall(fp.read())[0] 82 return cborutil.decodeall(fp.read())[0]
83 83
84 def delete(self): 84 def delete(self):