hgext/remotefilelog/historypack.py
changeset 44452 9d2b2df2c2ba
parent 44062 2d49482d0dd4
child 47012 d55b71393907
equal deleted inserted replaced
44449:ff72bd52d56a 44452:9d2b2df2c2ba
   130     def _getancestors(self, name, node, known=None):
   130     def _getancestors(self, name, node, known=None):
   131         if known is None:
   131         if known is None:
   132             known = set()
   132             known = set()
   133         section = self._findsection(name)
   133         section = self._findsection(name)
   134         filename, offset, size, nodeindexoffset, nodeindexsize = section
   134         filename, offset, size, nodeindexoffset, nodeindexsize = section
   135         pending = set((node,))
   135         pending = {node}
   136         o = 0
   136         o = 0
   137         while o < size:
   137         while o < size:
   138             if not pending:
   138             if not pending:
   139                 break
   139                 break
   140             entry, copyfrom = self._readentry(offset + o)
   140             entry, copyfrom = self._readentry(offset + o)
   289             ledger.markhistoryentry(self, filename, node)
   289             ledger.markhistoryentry(self, filename, node)
   290 
   290 
   291     def cleanup(self, ledger):
   291     def cleanup(self, ledger):
   292         entries = ledger.sources.get(self, [])
   292         entries = ledger.sources.get(self, [])
   293         allkeys = set(self)
   293         allkeys = set(self)
   294         repackedkeys = set(
   294         repackedkeys = {
   295             (e.filename, e.node) for e in entries if e.historyrepacked
   295             (e.filename, e.node) for e in entries if e.historyrepacked
   296         )
   296         }
   297 
   297 
   298         if len(allkeys - repackedkeys) == 0:
   298         if len(allkeys - repackedkeys) == 0:
   299             if self.path not in ledger.created:
   299             if self.path not in ledger.created:
   300                 util.unlinkpath(self.indexpath, ignoremissing=True)
   300                 util.unlinkpath(self.indexpath, ignoremissing=True)
   301                 util.unlinkpath(self.packpath, ignoremissing=True)
   301                 util.unlinkpath(self.packpath, ignoremissing=True)
   450         for filename in sorted(self.fileentries):
   450         for filename in sorted(self.fileentries):
   451             entries = self.fileentries[filename]
   451             entries = self.fileentries[filename]
   452             sectionstart = self.packfp.tell()
   452             sectionstart = self.packfp.tell()
   453 
   453 
   454             # Write the file section content
   454             # Write the file section content
   455             entrymap = dict((e[0], e) for e in entries)
   455             entrymap = {e[0]: e for e in entries}
   456 
   456 
   457             def parentfunc(node):
   457             def parentfunc(node):
   458                 x, p1, p2, x, x, x = entrymap[node]
   458                 x, p1, p2, x, x, x = entrymap[node]
   459                 parents = []
   459                 parents = []
   460                 if p1 != nullid:
   460                 if p1 != nullid: