obsstore: record data as floating point in fm0 format
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 16 Oct 2014 14:46:37 -0700
changeset 23002 2920a96f5839
parent 23001 4df9b5e62f70
child 23003 62d19ce9d7b6
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).
mercurial/obsolete.py
--- a/mercurial/obsolete.py	Tue Oct 14 01:27:25 2014 -0700
+++ b/mercurial/obsolete.py	Thu Oct 16 14:46:37 2014 -0700
@@ -202,7 +202,8 @@
     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