Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlogutils/deltas.py @ 43077:687b865b95ad
formatting: byteify all mercurial/ and hgext/ string literals
Done with
python3.7 contrib/byteify-strings.py -i $(hg files 'set:mercurial/**.py - mercurial/thirdparty/** + hgext/**.py - hgext/fsmonitor/pywatchman/** - mercurial/__init__.py')
black -l 80 -t py33 -S $(hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**')
# skip-blame mass-reformatting only
Differential Revision: https://phab.mercurial-scm.org/D6972
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:48:39 -0400 |
parents | 2372284d9457 |
children | c59eb1560c44 |
comparison
equal
deleted
inserted
replaced
43076:2372284d9457 | 43077:687b865b95ad |
---|---|
512 def _textfromdelta(fh, revlog, baserev, delta, p1, p2, flags, expectednode): | 512 def _textfromdelta(fh, revlog, baserev, delta, p1, p2, flags, expectednode): |
513 """build full text from a (base, delta) pair and other metadata""" | 513 """build full text from a (base, delta) pair and other metadata""" |
514 # special case deltas which replace entire base; no need to decode | 514 # special case deltas which replace entire base; no need to decode |
515 # base revision. this neatly avoids censored bases, which throw when | 515 # base revision. this neatly avoids censored bases, which throw when |
516 # they're decoded. | 516 # they're decoded. |
517 hlen = struct.calcsize(">lll") | 517 hlen = struct.calcsize(b">lll") |
518 if delta[:hlen] == mdiff.replacediffheader( | 518 if delta[:hlen] == mdiff.replacediffheader( |
519 revlog.rawsize(baserev), len(delta) - hlen | 519 revlog.rawsize(baserev), len(delta) - hlen |
520 ): | 520 ): |
521 fulltext = delta[hlen:] | 521 fulltext = delta[hlen:] |
522 else: | 522 else: |
529 validatehash = flagutil.processflagsraw(revlog, fulltext, flags) | 529 validatehash = flagutil.processflagsraw(revlog, fulltext, flags) |
530 if validatehash: | 530 if validatehash: |
531 revlog.checkhash(fulltext, expectednode, p1=p1, p2=p2) | 531 revlog.checkhash(fulltext, expectednode, p1=p1, p2=p2) |
532 if flags & REVIDX_ISCENSORED: | 532 if flags & REVIDX_ISCENSORED: |
533 raise error.StorageError( | 533 raise error.StorageError( |
534 _('node %s is not censored') % expectednode | 534 _(b'node %s is not censored') % expectednode |
535 ) | 535 ) |
536 except error.CensoredNodeError: | 536 except error.CensoredNodeError: |
537 # must pass the censored index flag to add censored revisions | 537 # must pass the censored index flag to add censored revisions |
538 if not flags & REVIDX_ISCENSORED: | 538 if not flags & REVIDX_ISCENSORED: |
539 raise | 539 raise |
724 yield None | 724 yield None |
725 | 725 |
726 | 726 |
727 def _findsnapshots(revlog, cache, start_rev): | 727 def _findsnapshots(revlog, cache, start_rev): |
728 """find snapshot from start_rev to tip""" | 728 """find snapshot from start_rev to tip""" |
729 if util.safehasattr(revlog.index, 'findsnapshots'): | 729 if util.safehasattr(revlog.index, b'findsnapshots'): |
730 revlog.index.findsnapshots(cache, start_rev) | 730 revlog.index.findsnapshots(cache, start_rev) |
731 else: | 731 else: |
732 deltaparent = revlog.deltaparent | 732 deltaparent = revlog.deltaparent |
733 issnapshot = revlog.issnapshot | 733 issnapshot = revlog.issnapshot |
734 for rev in revlog.revs(start_rev): | 734 for rev in revlog.revs(start_rev): |