Mercurial > hg
comparison mercurial/obsolete.py @ 23002:2920a96f5839
obsstore: record data as floating point in fm0 format
For python struct module, "d" is double. But for python string
formating, "d" is integer. We want to preserve the floating point
nature of the data, so we store it in the metadata as floating
point. We use "%r" to make sure we get as many 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 made
fm1-stored markers not survive a round-trip to fm0 leading to duplicated
markers (or two markers very alike).
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 16 Oct 2014 14:46:37 -0700 |
parents | 32f15b361f36 |
children | 5817f71c2336 |
comparison
equal
deleted
inserted
replaced
23001:4df9b5e62f70 | 23002:2920a96f5839 |
---|---|
200 def _fm0encodeonemarker(marker): | 200 def _fm0encodeonemarker(marker): |
201 pre, sucs, flags, metadata, date, parents = marker | 201 pre, sucs, flags, metadata, date, parents = marker |
202 if flags & usingsha256: | 202 if flags & usingsha256: |
203 raise util.Abort(_('cannot handle sha256 with old obsstore format')) | 203 raise util.Abort(_('cannot handle sha256 with old obsstore format')) |
204 metadata = dict(metadata) | 204 metadata = dict(metadata) |
205 metadata['date'] = '%d %i' % date | 205 time, tz = date |
206 metadata['date'] = '%r %i' % (time, tz) | |
206 if parents is not None: | 207 if parents is not None: |
207 if not parents: | 208 if not parents: |
208 # mark that we explicitly recorded no parents | 209 # mark that we explicitly recorded no parents |
209 metadata['p0'] = '' | 210 metadata['p0'] = '' |
210 for i, p in enumerate(parents): | 211 for i, p in enumerate(parents): |