comparison hgext/obsolete.py @ 89:757153438e58

[obsolet] base64 encore obsolete rel for pushkey Yop this is ugly
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Mon, 19 Sep 2011 18:27:30 +0200
parents 246b8fefd0a5
children 5dcece86aeb0
comparison
equal deleted inserted replaced
88:64fe5a4f877e 89:757153438e58
77 from cStringIO import StringIO 77 from cStringIO import StringIO
78 except ImportError: 78 except ImportError:
79 from StringIO import StringIO 79 from StringIO import StringIO
80 80
81 from mercurial.i18n import _ 81 from mercurial.i18n import _
82
83 import base64
82 84
83 from mercurial import util 85 from mercurial import util
84 from mercurial import context 86 from mercurial import context
85 from mercurial import revset 87 from mercurial import revset
86 from mercurial import scmutil 88 from mercurial import scmutil
219 """dump all obsolete relation in 221 """dump all obsolete relation in
220 222
221 XXX this have be improved""" 223 XXX this have be improved"""
222 tmp = StringIO() 224 tmp = StringIO()
223 _obsserialise(repo._obssubrels, tmp) 225 _obsserialise(repo._obssubrels, tmp)
224 return {'relations': tmp.getvalue()} 226 return {'relations': base64.b64encode(tmp.getvalue())}
225 227
226 pushkey.register('obsolete', pushobsolete, listobsolete) 228 pushkey.register('obsolete', pushobsolete, listobsolete)
227 229
228 ### New commands 230 ### New commands
229 ############################# 231 #############################
403 def pull(self, remote, *args, **kwargs): 405 def pull(self, remote, *args, **kwargs):
404 """wrapper around push that push obsolete relation""" 406 """wrapper around push that push obsolete relation"""
405 result = opull(remote, *args, **kwargs) 407 result = opull(remote, *args, **kwargs)
406 if 'obsolete' in remote.listkeys('namespaces'): 408 if 'obsolete' in remote.listkeys('namespaces'):
407 tmp = StringIO() 409 tmp = StringIO()
408 tmp.write(remote.listkeys('obsolete')['relations']) 410 rels = remote.listkeys('obsolete')['relations']
411 tmp.write(base64.b64decode(rels))
409 tmp.seek(0) 412 tmp.seek(0)
410 obsrels = _obsdeserialise(tmp) 413 obsrels = _obsdeserialise(tmp)
411 for sub, objs in obsrels.iteritems(): 414 for sub, objs in obsrels.iteritems():
412 for obj in objs: 415 for obj in objs:
413 self.addobsolete(sub, obj) 416 self.addobsolete(sub, obj)