changeset 22332:13e22358e9d2

obsolete: have _readmarkers return the format version readmarkers is not returning the version of the format it read from. This will let callers know about the format and allow them to preserve it.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 25 Aug 2014 16:51:51 +0200
parents b130b241718e
children 5bf18f8ca89d
files mercurial/obsolete.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/obsolete.py	Mon Aug 25 16:16:01 2014 +0200
+++ b/mercurial/obsolete.py	Mon Aug 25 16:51:51 2014 +0200
@@ -145,7 +145,7 @@
     if diskversion not in formats:
         raise util.Abort(_('parsing obsolete marker: unknown version %r')
                          % diskversion)
-    return formats[diskversion][0](data, off)
+    return diskversion, formats[diskversion][0](data, off)
 
 def _fm0readmarkers(data, off=0):
     """Read and enumerate markers from raw data in format version 0"""
@@ -312,7 +312,8 @@
         self.sopener = sopener
         data = sopener.tryread('obsstore')
         if data:
-            self._load(_readmarkers(data))
+            version, markers = _readmarkers(data)
+            self._load(markers)
 
     def __iter__(self):
         return iter(self._all)
@@ -396,7 +397,7 @@
         """merge a binary stream of markers inside the obsstore
 
         Returns the number of new markers added."""
-        markers = _readmarkers(data)
+        version, markers = _readmarkers(data)
         return self.add(transaction, markers)
 
     def _load(self, markers):