changeset 56:27f9c0d0a996

[obsolete] Update pushkey code
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Thu, 08 Sep 2011 19:07:00 +0200
parents cf4626a13345
children 62f2fe22bd42
files hgext/obsolete.py
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/obsolete.py	Thu Sep 08 19:03:42 2011 +0200
+++ b/hgext/obsolete.py	Thu Sep 08 19:07:00 2011 +0200
@@ -229,19 +229,20 @@
         ### pull // push support
 
         def pull(self, remote, *args, **kwargs):
-            obskey = remote.listkeys('obsolete')
-            obsrels = obskey.get('relations', {})
             result = opull(remote, *args, **kwargs)
-            for sub, objs in obsrels.iteritems():
-                for obj in objs:
-                    self.addobsolete(sub, obj)
+            if 'obsolete' in remote.listkeys('namespaces'):
+                tmp = StringIO()
+                tmp.write(remote.listkeys('obsolete')['relations'])
+                tmp.seek(0)
+                obsrels = repo._obsdeserialise(tmp)
+                for sub, objs in obsrels.iteritems():
+                    for obj in objs:
+                        self.addobsolete(sub, obj)
             return result
 
         def push(self, remote, *args, **opts):
-            obskey = remote.listkeys('obsolete')
-            obssupport = 'relations' in obskey
             result = opush(remote, *args, **opts)
-            if obssupport:
+            if 'obsolete' in remote.listkeys('namespaces'):
                 tmp = StringIO()
                 repo._obsserialise(tmp)
                 remote.pushkey('obsolete', 'relations', {}, tmp.getvalue())