Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 19054:d5f968f7716f
obsolete: extract obsolescence marker pulling into a dedicated function
Having a dedicated function will allow 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.
Some transaction tricks are necessary for pull. But nothing too scary.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Wed, 17 Apr 2013 11:47:49 +0200 |
parents | f74f2a4e3327 |
children | 0e4af72cbd7f |
line wrap: on
line diff
--- a/mercurial/localrepo.py Wed Apr 17 11:18:36 2013 +0200 +++ b/mercurial/localrepo.py Wed Apr 17 11:47:49 2013 +0200 @@ -8,7 +8,7 @@ from i18n import _ import peer, changegroup, subrepo, discovery, pushkey, obsolete, repoview import changelog, dirstate, filelog, manifest, context, bookmarks, phases -import lock, transaction, store, encoding, base85 +import lock, transaction, store, encoding import scmutil, util, extensions, hook, error, revset import match as matchmod import merge as mergemod @@ -1717,17 +1717,15 @@ # should be seen as public phases.advanceboundary(self, phases.public, subset) - if obsolete._enabled: - self.ui.debug('fetching remote obsolete markers\n') - remoteobs = remote.listkeys('obsolete') - if 'dump0' in remoteobs: - if tr is None: - tr = self.transaction(trname) - for key in sorted(remoteobs, reverse=True): - if key.startswith('dump'): - data = base85.b85decode(remoteobs[key]) - self.obsstore.mergemarkers(tr, data) - self.invalidatevolatilesets() + def gettransaction(): + if tr is None: + return self.transaction(trname) + return tr + + obstr = obsolete.syncpull(self, remote, gettransaction) + if obstr is not None: + tr = obstr + if tr is not None: tr.close() finally: