##// END OF EJS Templates
pull: move obsolescence marker exchange in the exchange module...
Pierre-Yves David -
r20476:1180c6ec default
parent child Browse files
Show More
@@ -8,7 +8,7 b''
8 8 from i18n import _
9 9 from node import hex, nullid
10 10 import errno
11 import util, scmutil, changegroup
11 import util, scmutil, changegroup, base85
12 12 import discovery, phases, obsolete, bookmarks
13 13
14 14
@@ -393,7 +393,7 b' class pulloperation(object):'
393 393 self.force = force
394 394
395 395 def pull(repo, remote, heads=None, force=False):
396 pullop = pulloperation(repo, remote, heads)
396 pullop = pulloperation(repo, remote, heads, force)
397 397 if pullop.remote.local():
398 398 missing = set(pullop.remote.requirements) - pullop.repo.supported
399 399 if missing:
@@ -470,7 +470,7 b' def pull(repo, remote, heads=None, force'
470 470 return pullop.repo.transaction(trname)
471 471 return tr
472 472
473 obstr = obsolete.syncpull(pullop.repo, pullop.remote, gettransaction)
473 obstr = _pullobsolete(pullop.repo, pullop.remote, gettransaction)
474 474 if obstr is not None:
475 475 tr = obstr
476 476
@@ -482,3 +482,25 b' def pull(repo, remote, heads=None, force'
482 482 lock.release()
483 483
484 484 return result
485
486 def _pullobsolete(repo, remote, gettransaction):
487 """utility function to pull obsolete markers from a remote
488
489 The `gettransaction` is function that return the pull transaction, creating
490 one if necessary. We return the transaction to inform the calling code that
491 a new transaction have been created (when applicable).
492
493 Exists mostly to allow overriding for experimentation purpose"""
494 tr = None
495 if obsolete._enabled:
496 repo.ui.debug('fetching remote obsolete markers\n')
497 remoteobs = remote.listkeys('obsolete')
498 if 'dump0' in remoteobs:
499 tr = gettransaction()
500 for key in sorted(remoteobs, reverse=True):
501 if key.startswith('dump'):
502 data = base85.b85decode(remoteobs[key])
503 repo.obsstore.mergemarkers(tr, data)
504 repo.invalidatevolatilesets()
505 return tr
506
@@ -384,27 +384,6 b' def pushmarker(repo, key, old, new):'
384 384 finally:
385 385 lock.release()
386 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
408 387 def allmarkers(repo):
409 388 """all obsolete markers known in a repository"""
410 389 for markerdata in repo.obsstore:
General Comments 0
You need to be logged in to leave comments. Login now