equal
deleted
inserted
replaced
20 util, |
20 util, |
21 vfs as vfsmod, |
21 vfs as vfsmod, |
22 ) |
22 ) |
23 from . import shallowutil |
23 from . import shallowutil |
24 |
24 |
25 osutil = policy.importmod(r'osutil') |
25 osutil = policy.importmod('osutil') |
26 |
26 |
27 # The pack version supported by this implementation. This will need to be |
27 # The pack version supported by this implementation. This will need to be |
28 # rev'd whenever the byte format changes. Ex: changing the fanout prefix, |
28 # rev'd whenever the byte format changes. Ex: changing the fanout prefix, |
29 # changing any of the int sizes, changing the delta algorithm, etc. |
29 # changing any of the int sizes, changing the delta algorithm, etc. |
30 PACKVERSIONSIZE = 1 |
30 PACKVERSIONSIZE = 1 |
388 suffix=self.PACKSUFFIX + b'-tmp' |
388 suffix=self.PACKSUFFIX + b'-tmp' |
389 ) |
389 ) |
390 self.idxfp, self.idxpath = opener.mkstemp( |
390 self.idxfp, self.idxpath = opener.mkstemp( |
391 suffix=self.INDEXSUFFIX + b'-tmp' |
391 suffix=self.INDEXSUFFIX + b'-tmp' |
392 ) |
392 ) |
393 self.packfp = os.fdopen(self.packfp, r'wb+') |
393 self.packfp = os.fdopen(self.packfp, 'wb+') |
394 self.idxfp = os.fdopen(self.idxfp, r'wb+') |
394 self.idxfp = os.fdopen(self.idxfp, 'wb+') |
395 self.sha = hashlib.sha1() |
395 self.sha = hashlib.sha1() |
396 self._closed = False |
396 self._closed = False |
397 |
397 |
398 # The opener provides no way of doing permission fixup on files created |
398 # The opener provides no way of doing permission fixup on files created |
399 # via mkstemp, so we must fix it ourselves. We can probably fix this |
399 # via mkstemp, so we must fix it ourselves. We can probably fix this |
528 self.idxfp.write(struct.pack(b'!BB', self.VERSION, config)) |
528 self.idxfp.write(struct.pack(b'!BB', self.VERSION, config)) |
529 |
529 |
530 |
530 |
531 class indexparams(object): |
531 class indexparams(object): |
532 __slots__ = ( |
532 __slots__ = ( |
533 r'fanoutprefix', |
533 'fanoutprefix', |
534 r'fanoutstruct', |
534 'fanoutstruct', |
535 r'fanoutcount', |
535 'fanoutcount', |
536 r'fanoutsize', |
536 'fanoutsize', |
537 r'indexstart', |
537 'indexstart', |
538 ) |
538 ) |
539 |
539 |
540 def __init__(self, prefixsize, version): |
540 def __init__(self, prefixsize, version): |
541 self.fanoutprefix = prefixsize |
541 self.fanoutprefix = prefixsize |
542 |
542 |