Skip to content
Snippets Groups Projects
Commit 9007387a authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

branchcache: move head writing in a `_write_headers` method

Same rational: this will help having format variants.
parent 09782c09
No related branches found
No related tags found
2 merge requests!870Merge default into stable,!795branchcache: refactor reading and writing.
......@@ -581,10 +581,7 @@
try:
filename = self._filename(repo)
with repo.cachevfs(filename, b"w", atomictemp=True) as f:
cachekey = [hex(self.tipnode), b'%d' % self.tiprev]
if self.filteredhash is not None:
cachekey.append(hex(self.filteredhash))
f.write(b" ".join(cachekey) + b'\n')
self._write_header(f)
nodecount = self._write_heads(f)
repo.ui.log(
b'branchcache',
......@@ -601,6 +598,13 @@
% stringutil.forcebytestr(inst)
)
def _write_header(self, fp) -> None:
"""write the branch cache header to a file"""
cachekey = [hex(self.tipnode), b'%d' % self.tiprev]
if self.filteredhash is not None:
cachekey.append(hex(self.filteredhash))
fp.write(b" ".join(cachekey) + b'\n')
def _write_heads(self, fp) -> int:
"""write list of heads to a file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment