##// END OF EJS Templates
branchcache: move head writing in a `_write_heads` method...
marmoute -
r52357:09782c09 default
parent child Browse files
Show More
@@ -585,16 +585,7 b' class branchcache(_BaseBranchCache):'
585 if self.filteredhash is not None:
585 if self.filteredhash is not None:
586 cachekey.append(hex(self.filteredhash))
586 cachekey.append(hex(self.filteredhash))
587 f.write(b" ".join(cachekey) + b'\n')
587 f.write(b" ".join(cachekey) + b'\n')
588 nodecount = 0
588 nodecount = self._write_heads(f)
589 for label, nodes in sorted(self._entries.items()):
590 label = encoding.fromlocal(label)
591 for node in nodes:
592 nodecount += 1
593 if node in self._closednodes:
594 state = b'c'
595 else:
596 state = b'o'
597 f.write(b"%s %s %s\n" % (hex(node), state, label))
598 repo.ui.log(
589 repo.ui.log(
599 b'branchcache',
590 b'branchcache',
600 b'wrote %s with %d labels and %d nodes\n',
591 b'wrote %s with %d labels and %d nodes\n',
@@ -610,6 +601,22 b' class branchcache(_BaseBranchCache):'
610 % stringutil.forcebytestr(inst)
601 % stringutil.forcebytestr(inst)
611 )
602 )
612
603
604 def _write_heads(self, fp) -> int:
605 """write list of heads to a file
606
607 Return the number of heads written."""
608 nodecount = 0
609 for label, nodes in sorted(self._entries.items()):
610 label = encoding.fromlocal(label)
611 for node in nodes:
612 nodecount += 1
613 if node in self._closednodes:
614 state = b'c'
615 else:
616 state = b'o'
617 fp.write(b"%s %s %s\n" % (hex(node), state, label))
618 return nodecount
619
613 def _verifybranch(self, branch):
620 def _verifybranch(self, branch):
614 """verify head nodes for the given branch."""
621 """verify head nodes for the given branch."""
615 if not self._verify_node:
622 if not self._verify_node:
General Comments 0
You need to be logged in to leave comments. Login now