##// END OF EJS Templates
obsolete: extract obsolescence marker pulling into a dedicated function...
Pierre-Yves David -
r19054:d5f968f7 default
parent child Browse files
Show More
@@ -8,7 +8,7 b' from node import hex, nullid, short'
8 8 from i18n import _
9 9 import peer, changegroup, subrepo, discovery, pushkey, obsolete, repoview
10 10 import changelog, dirstate, filelog, manifest, context, bookmarks, phases
11 import lock, transaction, store, encoding, base85
11 import lock, transaction, store, encoding
12 12 import scmutil, util, extensions, hook, error, revset
13 13 import match as matchmod
14 14 import merge as mergemod
@@ -1717,17 +1717,15 b' class localrepository(object):'
1717 1717 # should be seen as public
1718 1718 phases.advanceboundary(self, phases.public, subset)
1719 1719
1720 if obsolete._enabled:
1721 self.ui.debug('fetching remote obsolete markers\n')
1722 remoteobs = remote.listkeys('obsolete')
1723 if 'dump0' in remoteobs:
1724 if tr is None:
1725 tr = self.transaction(trname)
1726 for key in sorted(remoteobs, reverse=True):
1727 if key.startswith('dump'):
1728 data = base85.b85decode(remoteobs[key])
1729 self.obsstore.mergemarkers(tr, data)
1730 self.invalidatevolatilesets()
1720 def gettransaction():
1721 if tr is None:
1722 return self.transaction(trname)
1723 return tr
1724
1725 obstr = obsolete.syncpull(self, remote, gettransaction)
1726 if obstr is not None:
1727 tr = obstr
1728
1731 1729 if tr is not None:
1732 1730 tr.close()
1733 1731 finally:
@@ -386,6 +386,27 b' def syncpush(repo, remote):'
386 386 msg = _('failed to push some obsolete markers!\n')
387 387 repo.ui.warn(msg)
388 388
389 def syncpull(repo, remote, gettransaction):
390 """utility function to pull bookmark to a remote
391
392 The `gettransaction` is function that return the pull transaction, creating
393 one if necessary. We return the transaction to inform the calling code that
394 a new transaction have been created (when applicable).
395
396 Exists mostly to allow overridding for experimentation purpose"""
397 tr = None
398 if _enabled:
399 repo.ui.debug('fetching remote obsolete markers\n')
400 remoteobs = remote.listkeys('obsolete')
401 if 'dump0' in remoteobs:
402 tr = gettransaction()
403 for key in sorted(remoteobs, reverse=True):
404 if key.startswith('dump'):
405 data = base85.b85decode(remoteobs[key])
406 repo.obsstore.mergemarkers(tr, data)
407 repo.invalidatevolatilesets()
408 return tr
409
389 410 def allmarkers(repo):
390 411 """all obsolete markers known in a repository"""
391 412 for markerdata in repo.obsstore:
General Comments 0
You need to be logged in to leave comments. Login now