sort and indent version record files

See #161.
This commit is contained in:
lilydjwg 2020-10-06 10:07:02 +08:00
parent 108016aa45
commit 71612ad9b8
2 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# MIT licensed
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
__version__ = '2.1'
__version__ = '2.2dev'

View File

@ -132,7 +132,12 @@ def read_verfile(file: Path) -> VersData:
return v
def write_verfile(file: Path, versions: VersData) -> None:
data = json.dumps(versions, ensure_ascii=False) + '\n'
# sort and indent to make it friendly to human and git
data = json.dumps(
dict(sorted(versions)),
indent=2,
ensure_ascii=False,
) + '\n'
safe_overwrite(str(file), data)
class Options(NamedTuple):