comparison 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
comparison
equal deleted inserted replaced
19053:f74f2a4e3327 19054:d5f968f7716f
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 from node import hex, nullid, short 7 from node import hex, nullid, short
8 from i18n import _ 8 from i18n import _
9 import peer, changegroup, subrepo, discovery, pushkey, obsolete, repoview 9 import peer, changegroup, subrepo, discovery, pushkey, obsolete, repoview
10 import changelog, dirstate, filelog, manifest, context, bookmarks, phases 10 import changelog, dirstate, filelog, manifest, context, bookmarks, phases
11 import lock, transaction, store, encoding, base85 11 import lock, transaction, store, encoding
12 import scmutil, util, extensions, hook, error, revset 12 import scmutil, util, extensions, hook, error, revset
13 import match as matchmod 13 import match as matchmod
14 import merge as mergemod 14 import merge as mergemod
15 import tags as tagsmod 15 import tags as tagsmod
16 from lock import release 16 from lock import release
1715 else: 1715 else:
1716 # Remote is old or publishing all common changesets 1716 # Remote is old or publishing all common changesets
1717 # should be seen as public 1717 # should be seen as public
1718 phases.advanceboundary(self, phases.public, subset) 1718 phases.advanceboundary(self, phases.public, subset)
1719 1719
1720 if obsolete._enabled: 1720 def gettransaction():
1721 self.ui.debug('fetching remote obsolete markers\n') 1721 if tr is None:
1722 remoteobs = remote.listkeys('obsolete') 1722 return self.transaction(trname)
1723 if 'dump0' in remoteobs: 1723 return tr
1724 if tr is None: 1724
1725 tr = self.transaction(trname) 1725 obstr = obsolete.syncpull(self, remote, gettransaction)
1726 for key in sorted(remoteobs, reverse=True): 1726 if obstr is not None:
1727 if key.startswith('dump'): 1727 tr = obstr
1728 data = base85.b85decode(remoteobs[key]) 1728
1729 self.obsstore.mergemarkers(tr, data)
1730 self.invalidatevolatilesets()
1731 if tr is not None: 1729 if tr is not None:
1732 tr.close() 1730 tr.close()
1733 finally: 1731 finally:
1734 if tr is not None: 1732 if tr is not None:
1735 tr.release() 1733 tr.release()