##// END OF EJS Templates
branchcache: move head writing in a `_write_headers` method...
marmoute -
r52358:9007387a default
parent child Browse files
Show More
@@ -581,10 +581,7 b' class branchcache(_BaseBranchCache):'
581 try:
581 try:
582 filename = self._filename(repo)
582 filename = self._filename(repo)
583 with repo.cachevfs(filename, b"w", atomictemp=True) as f:
583 with repo.cachevfs(filename, b"w", atomictemp=True) as f:
584 cachekey = [hex(self.tipnode), b'%d' % self.tiprev]
584 self._write_header(f)
585 if self.filteredhash is not None:
586 cachekey.append(hex(self.filteredhash))
587 f.write(b" ".join(cachekey) + b'\n')
588 nodecount = self._write_heads(f)
585 nodecount = self._write_heads(f)
589 repo.ui.log(
586 repo.ui.log(
590 b'branchcache',
587 b'branchcache',
@@ -601,6 +598,13 b' class branchcache(_BaseBranchCache):'
601 % stringutil.forcebytestr(inst)
598 % stringutil.forcebytestr(inst)
602 )
599 )
603
600
601 def _write_header(self, fp) -> None:
602 """write the branch cache header to a file"""
603 cachekey = [hex(self.tipnode), b'%d' % self.tiprev]
604 if self.filteredhash is not None:
605 cachekey.append(hex(self.filteredhash))
606 fp.write(b" ".join(cachekey) + b'\n')
607
604 def _write_heads(self, fp) -> int:
608 def _write_heads(self, fp) -> int:
605 """write list of heads to a file
609 """write list of heads to a file
606
610
General Comments 0
You need to be logged in to leave comments. Login now