Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlogutils/sidedata.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | c348d829d23a |
children | 687b865b95ad |
line wrap: on
line diff
--- a/mercurial/revlogutils/sidedata.py Sat Oct 05 10:29:34 2019 -0400 +++ b/mercurial/revlogutils/sidedata.py Sun Oct 06 09:45:02 2019 -0400 @@ -52,6 +52,7 @@ SIDEDATA_HEADER = struct.Struct(r'>H') SIDEDATA_ENTRY = struct.Struct(r'>HL20s') + def sidedatawriteprocessor(rl, text, sidedata): sidedata = list(sidedata.items()) sidedata.sort() @@ -64,10 +65,11 @@ rawtext.append(bytes(text)) return ''.join(rawtext), False + def sidedatareadprocessor(rl, text): sidedata = {} offset = 0 - nbentry, = SIDEDATA_HEADER.unpack(text[:SIDEDATA_HEADER.size]) + (nbentry,) = SIDEDATA_HEADER.unpack(text[: SIDEDATA_HEADER.size]) offset += SIDEDATA_HEADER.size dataoffset = SIDEDATA_HEADER.size + (SIDEDATA_ENTRY.size * nbentry) for i in range(nbentry): @@ -85,10 +87,12 @@ text = text[dataoffset:] return text, True, sidedata + def sidedatarawprocessor(rl, text): # side data modifies rawtext and prevent rawtext hash validation return False + processors = ( sidedatareadprocessor, sidedatawriteprocessor,