[PATCH v9 RFC] scmutil: add a simple key-value file helper

Sean Farley sean at farley.io
Thu Jan 19 14:26:56 EST 2017


Kostia Balytskyi <ikostia at fb.com> writes:

> # HG changeset patch
> # User Kostia Balytskyi <ikostia at fb.com>
> # Date 1484824655 28800
> #      Thu Jan 19 03:17:35 2017 -0800
> # Node ID 19a449c91ef14e691cf1347748473e0094fedc86
> # Parent  9f264adbe75bfae8551dc0e6e0fce8d43fc7b43a
> scmutil: add a simple key-value file helper
>
> The purpose of the added class is to serve purposes like save files of shelve
> or state files of shelve, rebase and histedit. Keys of these files can be
> alphanumeric and start with letters, while values must not contain newlines.
> Keys which start with an uppercase letter are required, while other keys
> are optional.
>
> In light of Mercurial's reluctancy to use Python's json module, this tries
> to provide a reasonable alternative for a non-nested named data.
> Comparing to current approach of storing state in plain text files, where
> semantic meaning of lines of text is only determined by their oreder,
> simple key-value file allows for reordering lines and thus helps handle
> optional values.
>
> Initial use-case I see for this is obs-shelve's shelve files. Later we
> can possibly migrate state files to this approach.
>
> The test is in a new file beause I did not figure out where to put it
> within existing test suite. If you give me a better idea, I will gladly
> follow it.

Let's hold off until the freeze is over.


More information about the Mercurial-devel mailing list