changeset 404:4a5488c01a66 stable 0.6

obsolete: improve compat with new core dump%i scheme
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Tue, 31 Jul 2012 11:53:41 +0200
parents 9dda5c1f6a45
children 24762f1911ba
files hgext/obsolete.py
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/obsolete.py	Fri Jul 27 15:04:55 2012 +0200
+++ b/hgext/obsolete.py	Tue Jul 31 11:53:41 2012 +0200
@@ -436,7 +436,9 @@
     if not repo.obsstore:
         return {}
     data = repo.obsstore._writemarkers()
-    return {'dump': base85.b85encode(data)}
+    encdata = base85.b85encode(data)
+    return {'dump0': encdata,
+            'dump': encdata} # legacy compat
 
 def pushmarker(repo, key, old, new):
     """Push markers over pushkey"""
@@ -1189,8 +1191,12 @@
                 result = opull(remote, *args, **kwargs)
                 remoteobs = remote.listkeys('obsolete')
                 if 'dump' in remoteobs:
-                    data = base85.b85decode(remoteobs['dump'])
-                    self.obsstore.mergemarkers(data)
+                    remoteobs['dump0'] = remoteobs.pop('dump')
+                if 'dump0' in remoteobs:
+                    for key, values in remoteobs.iteritems():
+                        if key.startswith('dump'):
+                            data = base85.b85decode(remoteobs['dump0'])
+                            self.obsstore.mergemarkers(data)
                     self._clearobsoletecache()
                     self._turn_extinct_secret()
                     return result
@@ -1211,7 +1217,7 @@
                 raise
             if 'obsolete' in remote.listkeys('namespaces') and self.obsstore:
                 data = self.obsstore._writemarkers()
-                r = remote.pushkey('obsolete', 'dump', '',
+                r = remote.pushkey('obsolete', 'dump0', '',
                                    base85.b85encode(data))
                 if not r:
                     self.ui.warn(_('failed to push obsolete markers!\n'))