hgext/remotefilelog/historypack.py
changeset 47012 d55b71393907
parent 44452 9d2b2df2c2ba
child 48875 6000f5b25c9b
equal deleted inserted replaced
46992:5fa019ceb499 47012:d55b71393907
     1 from __future__ import absolute_import
     1 from __future__ import absolute_import
     2 
     2 
     3 import struct
     3 import struct
     4 
     4 
     5 from mercurial.node import hex, nullid
     5 from mercurial.node import (
       
     6     hex,
       
     7     sha1nodeconstants,
       
     8 )
     6 from mercurial import (
     9 from mercurial import (
     7     pycompat,
    10     pycompat,
     8     util,
    11     util,
     9 )
    12 )
    10 from mercurial.utils import hashutil
    13 from mercurial.utils import hashutil
   145             ancnode = entry[ANC_NODE]
   148             ancnode = entry[ANC_NODE]
   146             if ancnode in pending:
   149             if ancnode in pending:
   147                 pending.remove(ancnode)
   150                 pending.remove(ancnode)
   148                 p1node = entry[ANC_P1NODE]
   151                 p1node = entry[ANC_P1NODE]
   149                 p2node = entry[ANC_P2NODE]
   152                 p2node = entry[ANC_P2NODE]
   150                 if p1node != nullid and p1node not in known:
   153                 if p1node != sha1nodeconstants.nullid and p1node not in known:
   151                     pending.add(p1node)
   154                     pending.add(p1node)
   152                 if p2node != nullid and p2node not in known:
   155                 if p2node != sha1nodeconstants.nullid and p2node not in known:
   153                     pending.add(p2node)
   156                     pending.add(p2node)
   154 
   157 
   155                 yield (ancnode, p1node, p2node, entry[ANC_LINKNODE], copyfrom)
   158                 yield (ancnode, p1node, p2node, entry[ANC_LINKNODE], copyfrom)
   156 
   159 
   157     def _readentry(self, offset):
   160     def _readentry(self, offset):
   455             entrymap = {e[0]: e for e in entries}
   458             entrymap = {e[0]: e for e in entries}
   456 
   459 
   457             def parentfunc(node):
   460             def parentfunc(node):
   458                 x, p1, p2, x, x, x = entrymap[node]
   461                 x, p1, p2, x, x, x = entrymap[node]
   459                 parents = []
   462                 parents = []
   460                 if p1 != nullid:
   463                 if p1 != sha1nodeconstants.nullid:
   461                     parents.append(p1)
   464                     parents.append(p1)
   462                 if p2 != nullid:
   465                 if p2 != sha1nodeconstants.nullid:
   463                     parents.append(p2)
   466                     parents.append(p2)
   464                 return parents
   467                 return parents
   465 
   468 
   466             sortednodes = list(
   469             sortednodes = list(
   467                 reversed(
   470                 reversed(