Submitter | Pierre-Yves David |
---|---|
Date | Oct. 16, 2014, 11:07 p.m. |
Message ID | <6f1411cda808c23be651.1413500828@marginatus.alto.octopoid.net> |
Download | mbox | patch |
Permalink | /patch/6352/ |
State | Accepted |
Headers | show |
Comments
On Thu, Oct 16, 2014 at 04:07:08PM -0700, Pierre-Yves David wrote: > # HG changeset patch > # User Pierre-Yves David <pierre-yves.david@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 Sure, I guess. > > 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@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
On Thu, Oct 16, 2014 at 04:07:08PM -0700, Pierre-Yves David wrote: > # HG changeset patch > # User Pierre-Yves David <pierre-yves.david@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 (for the robots: this is queued) > > 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@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
Patch
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):