[PATCH evolve-ext-V4] evolve: add new methods _evolvestatewrite, _evolvestateread, _evolvestatedelete

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sun Jan 3 10:33:15 CST 2016



On 12/21/2015 12:45 AM, Shusen LIU wrote:
> # HG changeset patch
> # User Shusen LIU <liushusen at fb.com>
> # Date 1450654456 28800
> #      Sun Dec 20 15:34:16 2015 -0800
> # Node ID a14a183b9457ba733bd04cec0662ef6ac957845d
> # Parent  52c276d2ddb2f076c84ef8258038ef7b5ee00fe4
> evolve: add new methods _evolvestatewrite, _evolvestateread, _evolvestatedelete
>
> This patch introduces three new methods to read/write/delete data in vfs file
> 'evolvestate'. Provide the first version of impl of these methods, the
> _fm0evolvestateversion = 0.
> This enable us to persist evolvestate data, restore evolvestate data, and
> delete it after it's no longer needed. And allows us to support a continued
> keywork to implement evolve state.
>
> diff --git a/hgext/evolve.py b/hgext/evolve.py
> --- a/hgext/evolve.py
> +++ b/hgext/evolve.py
> @@ -3692,3 +3692,35 @@
>           repo._bookmarks[book] = dest.node()
>       if oldbookmarks or destbookmarks:
>           repo._bookmarks.recordchange(tr)
> +
> +## Parsing and writing of version "0"
> +#
> +# The file contains one line, seperated by '\0', orig hex, dest hex, and commit
> +# message. Assuming commitmsg cannot contain '\0'.

 From past experience we usually design on disk format with the current 
properly:

- starts with an explicite version number to detect format changes.
- prefer full binary formatformat (<field-size><field-data>) instead of 
separator
- Usually try to have an extensible format by adding "field" identifier

The first point (version number) is the most important as it allow us to 
move forward with a better format. So we need such version number before 
moving forward with the on disk format.

the others points are less critical and if you are interested we can 
discuss them in person when I'm in London next week.

Cheers,

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list