| 1 | from __future__scip-python python python-stdlib 3.11 __future__/__init__: import annotationsscip-python python python-stdlib 3.11 __future__/annotations.annotations. |
| 2 | |
| 3 | import structscip-python python python-stdlib 3.11 struct/__init__: |
| 4 | |
| 5 | from mercurial.nodescip-python python mercurial 7.2.2 `mercurial.node`/__init__: import ( |
| 6 | hexscip-python python mercurial 7.2.2 `mercurial.node`/hex., |
| 7 | sha1nodeconstantsscip-python python mercurial 7.2.2 `mercurial.node`/sha1nodeconstants#, |
| 8 | ) |
| 9 | from mercurialscip-python python mercurial 7.2.2 mercurial/__init__: import ( |
| 10 | utilscip-python python mercurial 7.2.2 `mercurial.util`/__init__:, |
| 11 | ) |
| 12 | from mercurial.utilsscip-python python mercurial 7.2.2 `mercurial.utils`/__init__: import hashutilscip-python python mercurial 7.2.2 `mercurial.utils.hashutil`/__init__: |
| 13 | from . import ( |
| 14 | basepackscip-python python mercurial 7.2.2 basepack/__init__:, |
| 15 | constantsscip-python python mercurial 7.2.2 constants/__init__:, |
| 16 | shallowutilscip-python python mercurial 7.2.2 shallowutil/__init__:, |
| 17 | ) |
| 18 | |
| 19 | # (filename hash, offset, size) |
| 20 | INDEXFORMAT2scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/INDEXFORMAT2. = b'!20sQQII' |
| 21 | INDEXENTRYLENGTH2scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/INDEXENTRYLENGTH2. = structscip-python python python-stdlib 3.11 struct/__init__:.calcsizescip-python python python-stdlib 3.11 struct/calcsize().(INDEXFORMAT2scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/INDEXFORMAT2.) |
| 22 | NODELENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/NODELENGTH. = 20 |
| 23 | |
| 24 | NODEINDEXFORMATscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/NODEINDEXFORMAT. = b'!20sQ' |
| 25 | NODEINDEXENTRYLENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/NODEINDEXENTRYLENGTH. = structscip-python python python-stdlib 3.11 struct/__init__:.calcsizescip-python python python-stdlib 3.11 struct/calcsize().(NODEINDEXFORMATscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/NODEINDEXFORMAT.) |
| 26 | |
| 27 | # (node, p1, p2, linknode) |
| 28 | PACKFORMATscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/PACKFORMAT. = b"!20s20s20s20sH" |
| 29 | PACKENTRYLENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/PACKENTRYLENGTH. = 82 |
| 30 | |
| 31 | ENTRYCOUNTSIZEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ENTRYCOUNTSIZE. = 4 |
| 32 | |
| 33 | INDEXSUFFIXscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/INDEXSUFFIX. = b'.histidx' |
| 34 | PACKSUFFIXscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/PACKSUFFIX. = b'.histpack' |
| 35 | |
| 36 | ANC_NODEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ANC_NODE. = 0 |
| 37 | ANC_P1NODEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ANC_P1NODE. = 1 |
| 38 | ANC_P2NODEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ANC_P2NODE. = 2 |
| 39 | ANC_LINKNODEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ANC_LINKNODE. = 3 |
| 40 | ANC_COPYFROMscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ANC_COPYFROM. = 4 |
| 41 | |
| 42 | |
| 43 | class historypackstorescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#(basepackscip-python python mercurial 7.2.2 basepack/__init__:.basepackstorescip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepackstore#): |
| 44 | INDEXSUFFIXscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#INDEXSUFFIX. = INDEXSUFFIXscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/INDEXSUFFIX. |
| 45 | PACKSUFFIXscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#PACKSUFFIX. = PACKSUFFIXscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/PACKSUFFIX. |
| 46 | |
| 47 | def getpackscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getpack().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getpack().(self), pathscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getpack().(path)): |
| 48 | return historypackscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#(pathscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getpack().(path)) |
| 49 | |
| 50 | def getancestorsscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getancestors().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getancestors().(self), namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getancestors().(name), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getancestors().(node), knownscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getancestors().(known)=None): |
| 51 | for pack in selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getancestors().(self).packsscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepackstore#packs.: |
| 52 | try: |
| 53 | return pack.getancestors(namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getancestors().(name), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getancestors().(node), known=knownscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getancestors().(known)) |
| 54 | except KeyErrorscip-python python python-stdlib 3.11 builtins/KeyError#: |
| 55 | pass |
| 56 | |
| 57 | for pack in selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getancestors().(self).refreshscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepackstore#refresh().(): |
| 58 | try: |
| 59 | return pack.getancestors(namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getancestors().(name), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getancestors().(node), known=knownscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getancestors().(known)) |
| 60 | except KeyErrorscip-python python python-stdlib 3.11 builtins/KeyError#: |
| 61 | pass |
| 62 | |
| 63 | raise KeyErrorscip-python python python-stdlib 3.11 builtins/KeyError#((namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getancestors().(name), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getancestors().(node))) |
| 64 | |
| 65 | def getnodeinfoscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getnodeinfo().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getnodeinfo().(self), namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getnodeinfo().(name), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getnodeinfo().(node)): |
| 66 | for pack in selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getnodeinfo().(self).packsscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepackstore#packs.: |
| 67 | try: |
| 68 | return pack.getnodeinfo(namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getnodeinfo().(name), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getnodeinfo().(node)) |
| 69 | except KeyErrorscip-python python python-stdlib 3.11 builtins/KeyError#: |
| 70 | pass |
| 71 | |
| 72 | for pack in selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getnodeinfo().(self).refreshscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepackstore#refresh().(): |
| 73 | try: |
| 74 | return pack.getnodeinfo(namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getnodeinfo().(name), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getnodeinfo().(node)) |
| 75 | except KeyErrorscip-python python python-stdlib 3.11 builtins/KeyError#: |
| 76 | pass |
| 77 | |
| 78 | raise KeyErrorscip-python python python-stdlib 3.11 builtins/KeyError#((namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getnodeinfo().(name), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#getnodeinfo().(node))) |
| 79 | |
| 80 | def addscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#add().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#add().(self), filenamescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#add().(filename), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#add().(node), p1scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#add().(p1), p2scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#add().(p2), linknodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#add().(linknode), copyfromscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#add().(copyfrom)): |
| 81 | raise RuntimeErrorscip-python python python-stdlib 3.11 builtins/RuntimeError#( |
| 82 | b"cannot add to historypackstore (%s:%s)" % (filenamescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#add().(filename), hexscip-python python mercurial 7.2.2 `mercurial.node`/hex.(nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypackstore#add().(node))) |
| 83 | ) |
| 84 | |
| 85 | |
| 86 | class historypackscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#(basepackscip-python python mercurial 7.2.2 basepack/__init__:.basepackscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#): |
| 87 | INDEXSUFFIXscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#INDEXSUFFIX. = INDEXSUFFIXscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/INDEXSUFFIX. |
| 88 | PACKSUFFIXscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#PACKSUFFIX. = PACKSUFFIXscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/PACKSUFFIX. |
| 89 | |
| 90 | SUPPORTED_VERSIONSscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#SUPPORTED_VERSIONS. = [2] |
| 91 | |
| 92 | def __init__scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#__init__().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#__init__().(self), pathscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#__init__().(path)): |
| 93 | superscip-python python python-stdlib 3.11 builtins/super#().__init__scip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#__init__().(pathscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#__init__().(path)) |
| 94 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#__init__().(self).INDEXFORMATscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#INDEXFORMAT. = INDEXFORMAT2scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/INDEXFORMAT2. |
| 95 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#__init__().(self).INDEXENTRYLENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#INDEXENTRYLENGTH. = INDEXENTRYLENGTH2scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/INDEXENTRYLENGTH2. |
| 96 | |
| 97 | def getmissingscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getmissing().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getmissing().(self), keysscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getmissing().(keys)): |
| 98 | missing = [] |
| 99 | for name, node in keysscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getmissing().(keys): |
| 100 | try: |
| 101 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getmissing().(self)._findnodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(name, node) |
| 102 | except KeyErrorscip-python python python-stdlib 3.11 builtins/KeyError#: |
| 103 | missing.appendscip-python python python-stdlib 3.11 builtins/list#append().((name, node)) |
| 104 | |
| 105 | return missing |
| 106 | |
| 107 | def getancestorsscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getancestors().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getancestors().(self), namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getancestors().(name), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getancestors().(node), knownscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getancestors().(known)=None): |
| 108 | """Returns as many ancestors as we're aware of. |
| 109 | |
| 110 | return value: { |
| 111 | node: (p1, p2, linknode, copyfrom), |
| 112 | ... |
| 113 | } |
| 114 | """ |
| 115 | if knownscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getancestors().(known) and nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getancestors().(node) in knownscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getancestors().(known): |
| 116 | return [] |
| 117 | |
| 118 | ancestors = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getancestors().(self)._getancestorsscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_getancestors().(namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getancestors().(name), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getancestors().(node), knownscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_getancestors().(known)=knownscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getancestors().(known)) |
| 119 | results = {} |
| 120 | for ancnode, p1, p2, linknode, copyfrom in ancestors: |
| 121 | results[ancnode] = (p1, p2, linknode, copyfrom) |
| 122 | |
| 123 | if not results: |
| 124 | raise KeyErrorscip-python python python-stdlib 3.11 builtins/KeyError#((namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getancestors().(name), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getancestors().(node))) |
| 125 | return results |
| 126 | |
| 127 | def getnodeinfoscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getnodeinfo().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getnodeinfo().(self), namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getnodeinfo().(name), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getnodeinfo().(node)): |
| 128 | # Drop the node from the tuple before returning, since the result should |
| 129 | # just be (p1, p2, linknode, copyfrom) |
| 130 | return selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getnodeinfo().(self)._findnodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getnodeinfo().(name), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#getnodeinfo().(node))[1:] |
| 131 | |
| 132 | def _getancestorsscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_getancestors().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_getancestors().(self), namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_getancestors().(name), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_getancestors().(node), knownscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_getancestors().(known)=None): |
| 133 | if knownscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_getancestors().(known) is None: |
| 134 | knownscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_getancestors().(known) = setscip-python python python-stdlib 3.11 builtins/set#() |
| 135 | section = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_getancestors().(self)._findsectionscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_getancestors().(name)) |
| 136 | filename, offset, size, nodeindexoffset, nodeindexsize = section |
| 137 | pending = {nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_getancestors().(node)} |
| 138 | o = 0 |
| 139 | while o < size: |
| 140 | if not pending: |
| 141 | break |
| 142 | entry, copyfrom = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_getancestors().(self)._readentryscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_readentry().(offset + o) |
| 143 | o += PACKENTRYLENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/PACKENTRYLENGTH. |
| 144 | if copyfrom: |
| 145 | o += len(copyfrom) |
| 146 | |
| 147 | ancnode = entry[ANC_NODEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ANC_NODE.] |
| 148 | if ancnode in pending: |
| 149 | pending.removescip-python python python-stdlib 3.11 builtins/set#remove().(ancnode) |
| 150 | p1node = entry[ANC_P1NODEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ANC_P1NODE.] |
| 151 | p2node = entry[ANC_P2NODEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ANC_P2NODE.] |
| 152 | if p1node != sha1nodeconstantsscip-python python mercurial 7.2.2 `mercurial.node`/sha1nodeconstants#.nullidscip-python python mercurial 7.2.2 `mercurial.node`/sha1nodeconstants#nullid. and p1node not in knownscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_getancestors().(known): |
| 153 | pending.addscip-python python python-stdlib 3.11 builtins/set#add().(p1node) |
| 154 | if p2node != sha1nodeconstantsscip-python python mercurial 7.2.2 `mercurial.node`/sha1nodeconstants#.nullidscip-python python mercurial 7.2.2 `mercurial.node`/sha1nodeconstants#nullid. and p2node not in knownscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_getancestors().(known): |
| 155 | pending.addscip-python python python-stdlib 3.11 builtins/set#add().(p2node) |
| 156 | |
| 157 | yield (ancnode, p1node, p2node, entry[ANC_LINKNODEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ANC_LINKNODE.], copyfrom) |
| 158 | |
| 159 | def _readentryscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_readentry().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_readentry().(self), offsetscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_readentry().(offset)): |
| 160 | data = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_readentry().(self)._datascip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#_data. |
| 161 | entry = structscip-python python python-stdlib 3.11 struct/__init__:.unpackscip-python python python-stdlib 3.11 struct/unpack().( |
| 162 | PACKFORMATscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/PACKFORMAT., data[offsetscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_readentry().(offset) : offsetscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_readentry().(offset) + PACKENTRYLENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/PACKENTRYLENGTH.] |
| 163 | ) |
| 164 | copyfrom = None |
| 165 | copyfromlen = entry[ANC_COPYFROMscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ANC_COPYFROM.] |
| 166 | if copyfromlen != 0: |
| 167 | offsetscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_readentry().(offset) += PACKENTRYLENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/PACKENTRYLENGTH. |
| 168 | copyfrom = data[offsetscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_readentry().(offset) : offsetscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_readentry().(offset) + copyfromlen] |
| 169 | return entry, copyfrom |
| 170 | |
| 171 | def addscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#add().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#add().(self), filenamescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#add().(filename), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#add().(node), p1scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#add().(p1), p2scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#add().(p2), linknodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#add().(linknode), copyfromscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#add().(copyfrom)): |
| 172 | raise RuntimeErrorscip-python python python-stdlib 3.11 builtins/RuntimeError#( |
| 173 | b"cannot add to historypack (%s:%s)" % (filenamescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#add().(filename), hexscip-python python mercurial 7.2.2 `mercurial.node`/hex.(nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#add().(node))) |
| 174 | ) |
| 175 | |
| 176 | def _findnodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(self), namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(name), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(node)): |
| 177 | if selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(self).VERSIONscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/versionmixin#VERSION. == 0: |
| 178 | ancestors = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(self)._getancestorsscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_getancestors().(namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(name), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(node)) |
| 179 | for ancnode, p1node, p2node, linknode, copyfrom in ancestors: |
| 180 | if ancnode == nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(node): |
| 181 | return (ancnode, p1node, p2node, linknode, copyfrom) |
| 182 | else: |
| 183 | section = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(self)._findsectionscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(name)) |
| 184 | nodeindexoffset, nodeindexsize = section[3:] |
| 185 | entry = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(self)._bisectscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().( |
| 186 | nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(node), |
| 187 | nodeindexoffset, |
| 188 | nodeindexoffset + nodeindexsize, |
| 189 | NODEINDEXENTRYLENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/NODEINDEXENTRYLENGTH., |
| 190 | ) |
| 191 | if entry is not None: |
| 192 | nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(node), offset = structscip-python python python-stdlib 3.11 struct/__init__:.unpackscip-python python python-stdlib 3.11 struct/unpack().(NODEINDEXFORMATscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/NODEINDEXFORMAT., entry) |
| 193 | entry, copyfrom = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(self)._readentryscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_readentry().(offset) |
| 194 | # Drop the copyfromlen from the end of entry, and replace it |
| 195 | # with the copyfrom string. |
| 196 | return entry[:4] + (copyfrom,) |
| 197 | |
| 198 | raise KeyErrorscip-python python python-stdlib 3.11 builtins/KeyError#(b"unable to find history for %s:%s" % (namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(name), hexscip-python python mercurial 7.2.2 `mercurial.node`/hex.(nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findnode().(node)))) |
| 199 | |
| 200 | def _findsectionscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(self), namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(name)): |
| 201 | params = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(self).paramsscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#params. |
| 202 | namehash = hashutilscip-python python mercurial 7.2.2 `mercurial.utils.hashutil`/__init__:.sha1scip-python python mercurial 7.2.2 `mercurial.utils.hashutil`/sha1.(namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(name)).digest() |
| 203 | fanoutkey = structscip-python python python-stdlib 3.11 struct/__init__:.unpackscip-python python python-stdlib 3.11 struct/unpack().( |
| 204 | params.fanoutstructscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/indexparams#, namehash[: params.fanoutprefixscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/indexparams#] |
| 205 | )[0] |
| 206 | fanout = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(self)._fanouttablescip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#_fanouttable(). |
| 207 | |
| 208 | start = fanout[fanoutkey] + params.indexstartscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/indexparams# |
| 209 | indexend = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(self)._indexendscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#_indexend(). |
| 210 | |
| 211 | for i in rangescip-python python python-stdlib 3.11 builtins/range#(fanoutkey + 1, params.fanoutcountscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/indexparams#): |
| 212 | end = fanout[i] + params.indexstartscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/indexparams# |
| 213 | if end != start: |
| 214 | break |
| 215 | else: |
| 216 | end = indexend |
| 217 | |
| 218 | entry = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(self)._bisectscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(namehash, start, end, selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(self).INDEXENTRYLENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#INDEXENTRYLENGTH.) |
| 219 | if not entry: |
| 220 | raise KeyErrorscip-python python python-stdlib 3.11 builtins/KeyError#(namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(name)) |
| 221 | |
| 222 | rawentry = structscip-python python python-stdlib 3.11 struct/__init__:.unpackscip-python python python-stdlib 3.11 struct/unpack().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(self).INDEXFORMATscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#INDEXFORMAT., entry) |
| 223 | x, offset, size, nodeindexoffset, nodeindexsize = rawentry |
| 224 | rawnamelen = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(self)._indexscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#_index.[ |
| 225 | nodeindexoffset : nodeindexoffset + constantsscip-python python mercurial 7.2.2 constants/__init__:.FILENAMESIZEscip-python python mercurial 7.2.2 `hgext.remotefilelog.constants`/FILENAMESIZE. |
| 226 | ] |
| 227 | actualnamelen = structscip-python python python-stdlib 3.11 struct/__init__:.unpackscip-python python python-stdlib 3.11 struct/unpack().(b'!H', rawnamelen)[0] |
| 228 | nodeindexoffset += constantsscip-python python mercurial 7.2.2 constants/__init__:.FILENAMESIZEscip-python python mercurial 7.2.2 `hgext.remotefilelog.constants`/FILENAMESIZE. |
| 229 | actualname = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(self)._indexscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#_index.[ |
| 230 | nodeindexoffset : nodeindexoffset + actualnamelen |
| 231 | ] |
| 232 | if actualname != namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(name): |
| 233 | raise KeyErrorscip-python python python-stdlib 3.11 builtins/KeyError#( |
| 234 | b"found file name %s when looking for %s" % (actualname, namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(name)) |
| 235 | ) |
| 236 | nodeindexoffset += actualnamelen |
| 237 | |
| 238 | filenamelength = structscip-python python python-stdlib 3.11 struct/__init__:.unpackscip-python python python-stdlib 3.11 struct/unpack().( |
| 239 | b'!H', selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(self)._datascip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#_data.[offset : offset + constantsscip-python python mercurial 7.2.2 constants/__init__:.FILENAMESIZEscip-python python mercurial 7.2.2 `hgext.remotefilelog.constants`/FILENAMESIZE.] |
| 240 | )[0] |
| 241 | offset += constantsscip-python python mercurial 7.2.2 constants/__init__:.FILENAMESIZEscip-python python mercurial 7.2.2 `hgext.remotefilelog.constants`/FILENAMESIZE. |
| 242 | |
| 243 | actualname = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(self)._datascip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#_data.[offset : offset + filenamelength] |
| 244 | offset += filenamelength |
| 245 | |
| 246 | if namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(name) != actualname: |
| 247 | raise KeyErrorscip-python python python-stdlib 3.11 builtins/KeyError#( |
| 248 | b"found file name %s when looking for %s" % (actualname, namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(name)) |
| 249 | ) |
| 250 | |
| 251 | # Skip entry list size |
| 252 | offset += ENTRYCOUNTSIZEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ENTRYCOUNTSIZE. |
| 253 | |
| 254 | nodelistoffset = offset |
| 255 | nodelistsize = ( |
| 256 | size - constantsscip-python python mercurial 7.2.2 constants/__init__:.FILENAMESIZEscip-python python mercurial 7.2.2 `hgext.remotefilelog.constants`/FILENAMESIZE. - filenamelength - ENTRYCOUNTSIZEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ENTRYCOUNTSIZE. |
| 257 | ) |
| 258 | return ( |
| 259 | namescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_findsection().(name), |
| 260 | nodelistoffset, |
| 261 | nodelistsize, |
| 262 | nodeindexoffset, |
| 263 | nodeindexsize, |
| 264 | ) |
| 265 | |
| 266 | def _bisectscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(self), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(node), startscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(start), endscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(end), entrylenscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(entrylen)): |
| 267 | # Bisect between start and end to find node |
| 268 | origstart = startscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(start) |
| 269 | startnode = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(self)._indexscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#_index.[startscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(start) : startscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(start) + NODELENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/NODELENGTH.] |
| 270 | endnode = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(self)._indexscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#_index.[endscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(end) : endscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(end) + NODELENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/NODELENGTH.] |
| 271 | |
| 272 | if startnode == nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(node): |
| 273 | return selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(self)._indexscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#_index.[startscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(start) : startscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(start) + entrylenscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(entrylen)] |
| 274 | elif endnode == nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(node): |
| 275 | return selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(self)._indexscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#_index.[endscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(end) : endscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(end) + entrylenscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(entrylen)] |
| 276 | else: |
| 277 | while startscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(start) < endscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(end) - entrylenscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(entrylen): |
| 278 | mid = startscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(start) + (endscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(end) - startscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(start)) // 2 |
| 279 | mid = mid - ((mid - origstart) % entrylenscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(entrylen)) |
| 280 | midnode = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(self)._indexscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#_index.[mid : mid + NODELENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/NODELENGTH.] |
| 281 | if midnode == nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(node): |
| 282 | return selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(self)._indexscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#_index.[mid : mid + entrylenscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(entrylen)] |
| 283 | if nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(node) > midnode: |
| 284 | startscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(start) = mid |
| 285 | elif nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(node) < midnode: |
| 286 | endscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#_bisect().(end) = mid |
| 287 | return None |
| 288 | |
| 289 | def markledgerscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#markledger().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#markledger().(self), ledgerscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#markledger().(ledger), optionsscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#markledger().(options)=None): |
| 290 | for filename, node in selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#markledger().(self): |
| 291 | ledgerscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#markledger().(ledger).markhistoryentry(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#markledger().(self), filename, node) |
| 292 | |
| 293 | def cleanupscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#cleanup().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#cleanup().(self), ledgerscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#cleanup().(ledger)): |
| 294 | entries = ledgerscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#cleanup().(ledger).sources.get(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#cleanup().(self), []) |
| 295 | allkeys = setscip-python python python-stdlib 3.11 builtins/set#(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#cleanup().(self)) |
| 296 | repackedkeys = { |
| 297 | (e.filename, e.node) for e in entries if e.historyrepacked |
| 298 | } |
| 299 | |
| 300 | if len(allkeys - repackedkeys) == 0: |
| 301 | if selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#cleanup().(self).pathscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#path. not in ledgerscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#cleanup().(ledger).created: |
| 302 | utilscip-python python mercurial 7.2.2 `mercurial.util`/__init__:.unlinkpathscip-python python mercurial 7.2.2 `mercurial.util`/unlinkpath().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#cleanup().(self).indexpathscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#indexpath., ignoremissingscip-python python mercurial 7.2.2 `mercurial.util`/unlinkpath().(ignoremissing)=True) |
| 303 | utilscip-python python mercurial 7.2.2 `mercurial.util`/__init__:.unlinkpathscip-python python mercurial 7.2.2 `mercurial.util`/unlinkpath().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#cleanup().(self).packpathscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#packpath., ignoremissingscip-python python mercurial 7.2.2 `mercurial.util`/unlinkpath().(ignoremissing)=True) |
| 304 | |
| 305 | def __iter__scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#__iter__().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#__iter__().(self)): |
| 306 | for f, n, x, x, x, x in selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#__iter__().(self).iterentriesscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#iterentries().(): |
| 307 | yield f, n |
| 308 | |
| 309 | def iterentriesscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#iterentries().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#iterentries().(self)): |
| 310 | # Start at 1 to skip the header |
| 311 | offset = 1 |
| 312 | while offset < selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#iterentries().(self).datasizescip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#datasize.: |
| 313 | data = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#iterentries().(self)._datascip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#_data. |
| 314 | # <2 byte len> + <filename> |
| 315 | filenamelen = structscip-python python python-stdlib 3.11 struct/__init__:.unpackscip-python python python-stdlib 3.11 struct/unpack().( |
| 316 | b'!H', data[offset : offset + constantsscip-python python mercurial 7.2.2 constants/__init__:.FILENAMESIZEscip-python python mercurial 7.2.2 `hgext.remotefilelog.constants`/FILENAMESIZE.] |
| 317 | )[0] |
| 318 | offset += constantsscip-python python mercurial 7.2.2 constants/__init__:.FILENAMESIZEscip-python python mercurial 7.2.2 `hgext.remotefilelog.constants`/FILENAMESIZE. |
| 319 | filename = data[offset : offset + filenamelen] |
| 320 | offset += filenamelen |
| 321 | |
| 322 | revcount = structscip-python python python-stdlib 3.11 struct/__init__:.unpackscip-python python python-stdlib 3.11 struct/unpack().( |
| 323 | b'!I', data[offset : offset + ENTRYCOUNTSIZEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ENTRYCOUNTSIZE.] |
| 324 | )[0] |
| 325 | offset += ENTRYCOUNTSIZEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ENTRYCOUNTSIZE. |
| 326 | |
| 327 | for i in rangescip-python python python-stdlib 3.11 builtins/range#(revcount): |
| 328 | entry = structscip-python python python-stdlib 3.11 struct/__init__:.unpackscip-python python python-stdlib 3.11 struct/unpack().( |
| 329 | PACKFORMATscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/PACKFORMAT., data[offset : offset + PACKENTRYLENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/PACKENTRYLENGTH.] |
| 330 | ) |
| 331 | offset += PACKENTRYLENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/PACKENTRYLENGTH. |
| 332 | |
| 333 | copyfrom = data[offset : offset + entry[ANC_COPYFROMscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ANC_COPYFROM.]] |
| 334 | offset += entry[ANC_COPYFROMscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ANC_COPYFROM.] |
| 335 | |
| 336 | yield ( |
| 337 | filename, |
| 338 | entry[ANC_NODEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ANC_NODE.], |
| 339 | entry[ANC_P1NODEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ANC_P1NODE.], |
| 340 | entry[ANC_P2NODEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ANC_P2NODE.], |
| 341 | entry[ANC_LINKNODEscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/ANC_LINKNODE.], |
| 342 | copyfrom, |
| 343 | ) |
| 344 | |
| 345 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#iterentries().(self)._pagedinscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#_pagedin. += PACKENTRYLENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/PACKENTRYLENGTH. |
| 346 | |
| 347 | # If we've read a lot of data from the mmap, free some memory. |
| 348 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/historypack#iterentries().(self).freememoryscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/basepack#freememory().() |
| 349 | |
| 350 | |
| 351 | class mutablehistorypackscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#(basepackscip-python python mercurial 7.2.2 basepack/__init__:.mutablebasepackscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/mutablebasepack#): |
| 352 | """A class for constructing and serializing a histpack file and index. |
| 353 | |
| 354 | A history pack is a pair of files that contain the revision history for |
| 355 | various file revisions in Mercurial. It contains only revision history (like |
| 356 | parent pointers and linknodes), not any revision content information. |
| 357 | |
| 358 | It consists of two files, with the following format: |
| 359 | |
| 360 | .histpack |
| 361 | The pack itself is a series of file revisions with some basic header |
| 362 | information on each. |
| 363 | |
| 364 | datapack = <version: 1 byte> |
| 365 | [<filesection>,...] |
| 366 | filesection = <filename len: 2 byte unsigned int> |
| 367 | <filename> |
| 368 | <revision count: 4 byte unsigned int> |
| 369 | [<revision>,...] |
| 370 | revision = <node: 20 byte> |
| 371 | <p1node: 20 byte> |
| 372 | <p2node: 20 byte> |
| 373 | <linknode: 20 byte> |
| 374 | <copyfromlen: 2 byte> |
| 375 | <copyfrom> |
| 376 | |
| 377 | The revisions within each filesection are stored in topological order |
| 378 | (newest first). If a given entry has a parent from another file (a copy) |
| 379 | then p1node is the node from the other file, and copyfrom is the |
| 380 | filepath of the other file. |
| 381 | |
| 382 | .histidx |
| 383 | The index file provides a mapping from filename to the file section in |
| 384 | the histpack. In V1 it also contains sub-indexes for specific nodes |
| 385 | within each file. It consists of three parts, the fanout, the file index |
| 386 | and the node indexes. |
| 387 | |
| 388 | The file index is a list of index entries, sorted by filename hash (one |
| 389 | per file section in the pack). Each entry has: |
| 390 | |
| 391 | - node (The 20 byte hash of the filename) |
| 392 | - pack entry offset (The location of this file section in the histpack) |
| 393 | - pack content size (The on-disk length of this file section's pack |
| 394 | data) |
| 395 | - node index offset (The location of the file's node index in the index |
| 396 | file) [1] |
| 397 | - node index size (the on-disk length of this file's node index) [1] |
| 398 | |
| 399 | The fanout is a quick lookup table to reduce the number of steps for |
| 400 | bisecting the index. It is a series of 4 byte pointers to positions |
| 401 | within the index. It has 2^16 entries, which corresponds to hash |
| 402 | prefixes [00, 01, 02,..., FD, FE, FF]. Example: the pointer in slot 4F |
| 403 | points to the index position of the first revision whose node starts |
| 404 | with 4F. This saves log(2^16) bisect steps. |
| 405 | |
| 406 | dataidx = <fanouttable> |
| 407 | <file count: 8 byte unsigned> [1] |
| 408 | <fileindex> |
| 409 | <node count: 8 byte unsigned> [1] |
| 410 | [<nodeindex>,...] [1] |
| 411 | fanouttable = [<index offset: 4 byte unsigned int>,...] (2^16 entries) |
| 412 | |
| 413 | fileindex = [<file index entry>,...] |
| 414 | fileindexentry = <node: 20 byte> |
| 415 | <pack file section offset: 8 byte unsigned int> |
| 416 | <pack file section size: 8 byte unsigned int> |
| 417 | <node index offset: 4 byte unsigned int> [1] |
| 418 | <node index size: 4 byte unsigned int> [1] |
| 419 | nodeindex = <filename>[<node index entry>,...] [1] |
| 420 | filename = <filename len : 2 byte unsigned int><filename value> [1] |
| 421 | nodeindexentry = <node: 20 byte> [1] |
| 422 | <pack file node offset: 8 byte unsigned int> [1] |
| 423 | |
| 424 | [1]: new in version 1. |
| 425 | """ |
| 426 | |
| 427 | INDEXSUFFIXscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#INDEXSUFFIX. = INDEXSUFFIXscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/INDEXSUFFIX. |
| 428 | PACKSUFFIXscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#PACKSUFFIX. = PACKSUFFIXscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/PACKSUFFIX. |
| 429 | |
| 430 | SUPPORTED_VERSIONSscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#SUPPORTED_VERSIONS. = [2] |
| 431 | |
| 432 | def __init__scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#__init__().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#__init__().(self), uiscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#__init__().(ui), packpathscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#__init__().(packpath), versionscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#__init__().(version)=2): |
| 433 | superscip-python python python-stdlib 3.11 builtins/super#().__init__scip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/mutablebasepack#__init__().(uiscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#__init__().(ui), packpathscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#__init__().(packpath), versionscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/mutablebasepack#__init__().(version)=versionscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#__init__().(version)) |
| 434 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#__init__().(self).filesscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#files. = {} |
| 435 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#__init__().(self).entrylocationsscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#entrylocations. = {} |
| 436 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#__init__().(self).fileentriesscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#fileentries. = {} |
| 437 | |
| 438 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#__init__().(self).INDEXFORMATscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#INDEXFORMAT. = INDEXFORMAT2scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/INDEXFORMAT2. |
| 439 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#__init__().(self).INDEXENTRYLENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/mutablebasepack#INDEXENTRYLENGTH. = INDEXENTRYLENGTH2scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/INDEXENTRYLENGTH2. |
| 440 | |
| 441 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#__init__().(self).NODEINDEXFORMATscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#NODEINDEXFORMAT. = NODEINDEXFORMATscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/NODEINDEXFORMAT. |
| 442 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#__init__().(self).NODEINDEXENTRYLENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#NODEINDEXENTRYLENGTH. = NODEINDEXENTRYLENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/NODEINDEXENTRYLENGTH. |
| 443 | |
| 444 | def addscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(self), filenamescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(filename), nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(node), p1scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(p1), p2scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(p2), linknodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(linknode), copyfromscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(copyfrom)): |
| 445 | copyfromscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(copyfrom) = copyfromscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(copyfrom) or b'' |
| 446 | copyfromlen = structscip-python python python-stdlib 3.11 struct/__init__:.packscip-python python python-stdlib 3.11 struct/pack().(b'!H', len(copyfromscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(copyfrom))) |
| 447 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(self).fileentriesscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#fileentries..setdefaultscip-python python python-stdlib 3.11 typing/MutableMapping#setdefault().(filenamescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(filename), []).append( |
| 448 | (nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(node), p1scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(p1), p2scip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(p2), linknodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(linknode), copyfromlen, copyfromscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#add().(copyfrom)) |
| 449 | ) |
| 450 | |
| 451 | def _writescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#_write().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#_write().(self)): |
| 452 | for filename in sortedscip-python python python-stdlib 3.11 builtins/sorted().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#_write().(self).fileentriesscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#fileentries.): |
| 453 | entries = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#_write().(self).fileentriesscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#fileentries.[filename] |
| 454 | sectionstart = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#_write().(self).packfpscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/mutablebasepack#packfp..tellscip-python python python-stdlib 3.11 io/IOBase#tell().() |
| 455 | |
| 456 | # Write the file section content |
| 457 | entrymap = {e[0]: e for e in entries} |
| 458 | |
| 459 | def parentfuncscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#parentfunc().(nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#parentfunc().(node)): |
| 460 | x, p1, p2, x, x, x = entrymap[nodescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#parentfunc().(node)] |
| 461 | parents = [] |
| 462 | if p1 != sha1nodeconstantsscip-python python mercurial 7.2.2 `mercurial.node`/sha1nodeconstants#.nullidscip-python python mercurial 7.2.2 `mercurial.node`/sha1nodeconstants#nullid.: |
| 463 | parents.appendscip-python python python-stdlib 3.11 builtins/list#append().(p1) |
| 464 | if p2 != sha1nodeconstantsscip-python python mercurial 7.2.2 `mercurial.node`/sha1nodeconstants#.nullidscip-python python mercurial 7.2.2 `mercurial.node`/sha1nodeconstants#nullid.: |
| 465 | parents.appendscip-python python python-stdlib 3.11 builtins/list#append().(p2) |
| 466 | return parents |
| 467 | |
| 468 | sortednodes = listscip-python python python-stdlib 3.11 builtins/list#( |
| 469 | reversedscip-python python python-stdlib 3.11 builtins/reversed#( |
| 470 | shallowutilscip-python python mercurial 7.2.2 shallowutil/__init__:.sortnodesscip-python python mercurial 7.2.2 `hgext.remotefilelog.shallowutil`/sortnodes().((e[0] for e in entries), parentfuncscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#parentfunc().) |
| 471 | ) |
| 472 | ) |
| 473 | |
| 474 | # Write the file section header |
| 475 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#_write().(self).writerawscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/mutablebasepack#writeraw().( |
| 476 | b"%s%s%s" |
| 477 | % ( |
| 478 | structscip-python python python-stdlib 3.11 struct/__init__:.packscip-python python python-stdlib 3.11 struct/pack().(b'!H', len(filename)), |
| 479 | filename, |
| 480 | structscip-python python python-stdlib 3.11 struct/__init__:.packscip-python python python-stdlib 3.11 struct/pack().(b'!I', len(sortednodes)), |
| 481 | ) |
| 482 | ) |
| 483 | |
| 484 | sectionlen = constantsscip-python python mercurial 7.2.2 constants/__init__:.FILENAMESIZEscip-python python mercurial 7.2.2 `hgext.remotefilelog.constants`/FILENAMESIZE. + len(filename) + 4 |
| 485 | |
| 486 | rawstrings = [] |
| 487 | |
| 488 | # Record the node locations for the index |
| 489 | locations = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#_write().(self).entrylocationsscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#entrylocations..setdefaultscip-python python python-stdlib 3.11 typing/MutableMapping#setdefault().(filename, {}) |
| 490 | offset = sectionstart + sectionlen |
| 491 | for node in sortednodes: |
| 492 | locations[node] = offset |
| 493 | raw = b'%s%s%s%s%s%s' % entrymap[node] |
| 494 | rawstrings.appendscip-python python python-stdlib 3.11 builtins/list#append().(raw) |
| 495 | offset += len(raw) |
| 496 | |
| 497 | rawdata = b''.joinscip-python python python-stdlib 3.11 builtins/bytes#join().(rawstrings) |
| 498 | sectionlen += len(rawdata) |
| 499 | |
| 500 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#_write().(self).writerawscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/mutablebasepack#writeraw().(rawdata) |
| 501 | |
| 502 | # Record metadata for the index |
| 503 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#_write().(self).filesscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#files.[filename] = (sectionstart, sectionlen) |
| 504 | node = hashutilscip-python python mercurial 7.2.2 `mercurial.utils.hashutil`/__init__:.sha1scip-python python mercurial 7.2.2 `mercurial.utils.hashutil`/sha1.(filename).digest() |
| 505 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#_write().(self).entriesscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/mutablebasepack#entries.[node] = node |
| 506 | |
| 507 | def closescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#close().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#close().(self), ledgerscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#close().(ledger)=None): |
| 508 | if selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#close().(self)._closedscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/mutablebasepack#_closed.: |
| 509 | return |
| 510 | |
| 511 | selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#close().(self)._writescip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#_write().() |
| 512 | |
| 513 | return superscip-python python python-stdlib 3.11 builtins/super#().closescip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/mutablebasepack#close().(ledgerscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/mutablebasepack#close().(ledger)=ledgerscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#close().(ledger)) |
| 514 | |
| 515 | def createindexscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#createindex().(selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#createindex().(self), nodelocationsscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#createindex().(nodelocations), indexoffsetscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#createindex().(indexoffset)): |
| 516 | fileindexformat = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#createindex().(self).INDEXFORMATscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#INDEXFORMAT. |
| 517 | fileindexlength = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#createindex().(self).INDEXENTRYLENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.basepack`/mutablebasepack#INDEXENTRYLENGTH. |
| 518 | nodeindexformat = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#createindex().(self).NODEINDEXFORMATscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#NODEINDEXFORMAT. |
| 519 | nodeindexlength = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#createindex().(self).NODEINDEXENTRYLENGTHscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#NODEINDEXENTRYLENGTH. |
| 520 | |
| 521 | files = ( |
| 522 | (hashutilscip-python python mercurial 7.2.2 `mercurial.utils.hashutil`/__init__:.sha1scip-python python mercurial 7.2.2 `mercurial.utils.hashutil`/sha1.(filename).digest(), filename, offset, size) |
| 523 | for filename, (offset, size) in selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#createindex().(self).filesscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#files..itemsscip-python python python-stdlib 3.11 builtins/dict#items().() |
| 524 | ) |
| 525 | files = sortedscip-python python python-stdlib 3.11 builtins/sorted().(files) |
| 526 | |
| 527 | # node index is after file index size, file index, and node index size |
| 528 | indexlensize = structscip-python python python-stdlib 3.11 struct/__init__:.calcsizescip-python python python-stdlib 3.11 struct/calcsize().(b'!Q') |
| 529 | nodeindexoffset = ( |
| 530 | indexoffsetscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#createindex().(indexoffset) |
| 531 | + indexlensize |
| 532 | + (len(files) * fileindexlength) |
| 533 | + indexlensize |
| 534 | ) |
| 535 | |
| 536 | fileindexentries = [] |
| 537 | nodeindexentries = [] |
| 538 | nodecount = 0 |
| 539 | for namehash, filename, offset, size in files: |
| 540 | # File section index |
| 541 | nodelocationsscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#createindex().(nodelocations) = selfscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#createindex().(self).entrylocationsscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#entrylocations.[filename] |
| 542 | |
| 543 | nodeindexsize = len(nodelocationsscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#createindex().(nodelocations)) * nodeindexlength |
| 544 | |
| 545 | rawentry = structscip-python python python-stdlib 3.11 struct/__init__:.packscip-python python python-stdlib 3.11 struct/pack().( |
| 546 | fileindexformat, |
| 547 | namehash, |
| 548 | offset, |
| 549 | size, |
| 550 | nodeindexoffset, |
| 551 | nodeindexsize, |
| 552 | ) |
| 553 | # Node index |
| 554 | nodeindexentries.appendscip-python python python-stdlib 3.11 builtins/list#append().( |
| 555 | structscip-python python python-stdlib 3.11 struct/__init__:.packscip-python python python-stdlib 3.11 struct/pack().(constantsscip-python python mercurial 7.2.2 constants/__init__:.FILENAMESTRUCTscip-python python mercurial 7.2.2 `hgext.remotefilelog.constants`/FILENAMESTRUCT., len(filename)) + filename |
| 556 | ) |
| 557 | nodeindexoffset += constantsscip-python python mercurial 7.2.2 constants/__init__:.FILENAMESIZEscip-python python mercurial 7.2.2 `hgext.remotefilelog.constants`/FILENAMESIZE. + len(filename) |
| 558 | |
| 559 | for node, location in sortedscip-python python python-stdlib 3.11 builtins/sorted().(nodelocationsscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#createindex().(nodelocations).items()): |
| 560 | nodeindexentries.appendscip-python python python-stdlib 3.11 builtins/list#append().( |
| 561 | structscip-python python python-stdlib 3.11 struct/__init__:.packscip-python python python-stdlib 3.11 struct/pack().(nodeindexformat, node, location) |
| 562 | ) |
| 563 | nodecount += 1 |
| 564 | |
| 565 | nodeindexoffset += len(nodelocationsscip-python python mercurial 7.2.2 `hgext.remotefilelog.historypack`/mutablehistorypack#createindex().(nodelocations)) * nodeindexlength |
| 566 | |
| 567 | fileindexentries.appendscip-python python python-stdlib 3.11 builtins/list#append().(rawentry) |
| 568 | |
| 569 | nodecountraw = structscip-python python python-stdlib 3.11 struct/__init__:.packscip-python python python-stdlib 3.11 struct/pack().(b'!Q', nodecount) |
| 570 | return ( |
| 571 | b''.joinscip-python python python-stdlib 3.11 builtins/bytes#join().(fileindexentries) |
| 572 | + nodecountraw |
| 573 | + b''.joinscip-python python python-stdlib 3.11 builtins/bytes#join().(nodeindexentries) |
| 574 | ) |