Mercurial > hg
comparison mercurial/obsolete.py @ 20476:1180c6ec5695
pull: move obsolescence marker exchange in the exchange module
The obsolescence marker exchange code was already extracted during a previous
cycle. We are moving the extracted functio in this module. This function will
read and write data in the `pulloperation` object and I prefer to have all core
function collaborating through this object in the same place.
This changeset is pure code movement only. Code change for direct consumption of
the `pulloperation` object will come later.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Thu, 30 Jan 2014 17:38:41 -0800 |
parents | 1b926f0bbf8a |
children | 3af218cf2007 |
comparison
equal
deleted
inserted
replaced
20475:b79b405583af | 20476:1180c6ec5695 |
---|---|
381 return 1 | 381 return 1 |
382 finally: | 382 finally: |
383 tr.release() | 383 tr.release() |
384 finally: | 384 finally: |
385 lock.release() | 385 lock.release() |
386 | |
387 def syncpull(repo, remote, gettransaction): | |
388 """utility function to pull obsolete markers from a remote | |
389 | |
390 The `gettransaction` is function that return the pull transaction, creating | |
391 one if necessary. We return the transaction to inform the calling code that | |
392 a new transaction have been created (when applicable). | |
393 | |
394 Exists mostly to allow overriding for experimentation purpose""" | |
395 tr = None | |
396 if _enabled: | |
397 repo.ui.debug('fetching remote obsolete markers\n') | |
398 remoteobs = remote.listkeys('obsolete') | |
399 if 'dump0' in remoteobs: | |
400 tr = gettransaction() | |
401 for key in sorted(remoteobs, reverse=True): | |
402 if key.startswith('dump'): | |
403 data = base85.b85decode(remoteobs[key]) | |
404 repo.obsstore.mergemarkers(tr, data) | |
405 repo.invalidatevolatilesets() | |
406 return tr | |
407 | 386 |
408 def allmarkers(repo): | 387 def allmarkers(repo): |
409 """all obsolete markers known in a repository""" | 388 """all obsolete markers known in a repository""" |
410 for markerdata in repo.obsstore: | 389 for markerdata in repo.obsstore: |
411 yield marker(repo, markerdata) | 390 yield marker(repo, markerdata) |