[PATCH] obsstore: record data as floating point in fm0 format

Augie Fackler raf at durin42.com
Fri Oct 17 09:12:23 CDT 2014


On Thu, Oct 16, 2014 at 04:05:28PM -0700, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1413495997 25200
> #      Thu Oct 16 14:46:37 2014 -0700
> # Node ID 6f1411cda808c23be651f5b3a22430365b98f588
> # Parent  840be5ca03e1db16ba994e55597771c418166c97
> obsstore: record data as floating point in fm0 format

Looks like you sent this twice, so I'm going to ignore this one.

>
> For python struct module, "d" is double. But for python string formating, "d" is
> integer. We want to preserve the float nature of the data. So we store it the
> metadata as float. We use "%r" to make sure we get as much significant digitis as
> necessary to restore the float to the exact same value on the other side.
>
> The fm1 is transmitting the information as float. The lack of this makes
> fm1-stored markers not survive a round-trip to fm0 leading to duplicated
> markers (or two markers very alike).
>
> diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
> --- a/mercurial/obsolete.py
> +++ b/mercurial/obsolete.py
> @@ -200,11 +200,12 @@ def _fm0readmarkers(data, off=0):
>  def _fm0encodeonemarker(marker):
>      pre, sucs, flags, metadata, date, parents = marker
>      if flags & usingsha256:
>          raise util.Abort(_('cannot handle sha256 with old obsstore format'))
>      metadata = dict(metadata)
> -    metadata['date'] = '%d %i' % date
> +    time, tz = date
> +    metadata['date'] = '%r %i' % (time, tz)
>      if parents is not None:
>          if not parents:
>              # mark that we explicitly recorded no parents
>              metadata['p0'] = ''
>          for i, p in enumerate(parents):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list