comparison mercurial/obsolete.py @ 19053:f74f2a4e3327

obsolete: extract obsolescence marker pushing into a dedicated function Having a dedicated function will allows us to experiment with other exchange strategies in an extension. As we have no solid clues about how to do it right, being able to experiment is vital. I intended a more ambitious extraction of push logic, but we are far too advanced in the release cycle for it.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 17 Apr 2013 11:18:36 +0200
parents efef056b1ae9
children d5f968f7716f
comparison
equal deleted inserted replaced
19052:63a783d1ac85 19053:f74f2a4e3327
367 return 1 367 return 1
368 finally: 368 finally:
369 tr.release() 369 tr.release()
370 finally: 370 finally:
371 lock.release() 371 lock.release()
372
373 def syncpush(repo, remote):
374 """utility function to push bookmark to a remote
375
376 Exist mostly to allow overridding for experimentation purpose"""
377 if (_enabled and repo.obsstore and
378 'obsolete' in remote.listkeys('namespaces')):
379 rslts = []
380 remotedata = repo.listkeys('obsolete')
381 for key in sorted(remotedata, reverse=True):
382 # reverse sort to ensure we end with dump0
383 data = remotedata[key]
384 rslts.append(remote.pushkey('obsolete', key, '', data))
385 if [r for r in rslts if not r]:
386 msg = _('failed to push some obsolete markers!\n')
387 repo.ui.warn(msg)
372 388
373 def allmarkers(repo): 389 def allmarkers(repo):
374 """all obsolete markers known in a repository""" 390 """all obsolete markers known in a repository"""
375 for markerdata in repo.obsstore: 391 for markerdata in repo.obsstore:
376 yield marker(repo, markerdata) 392 yield marker(repo, markerdata)