def _pullbundle2(pullop): """pull data using bundle2 For now, the only supported data are changegroup.""" remotecaps = bundle2.bundle2caps(pullop.remote) kwargs = {'bundlecaps': caps20to10(pullop.repo)} # pulling changegroup pullop.stepsdone.add('changegroup') kwargs['common'] = pullop.common kwargs['heads'] = pullop.heads or pullop.rheads kwargs['cg'] = pullop.fetch if 'b2x:listkeys' in remotecaps: kwargs['listkeys'] = ['phase', 'bookmarks'] if not pullop.fetch: pullop.repo.ui.status(_("no changes found\n")) pullop.cgresult = 0 else: if pullop.heads is None and list(pullop.common) == [nullid]: pullop.repo.ui.status(_("requesting all changes\n")) if obsolete.isenabled(pullop.repo, obsolete.exchangeopt): remoteversions = bundle2.obsmarkersversion(remotecaps) if obsolete.commonversion(remoteversions) is not None: kwargs['obsmarkers'] = True pullop.stepsdone.add('obsmarkers') _pullbundle2extraprepare(pullop, kwargs) if kwargs.keys() == ['format']: return # nothing to pull bundle = pullop.remote.getbundle('pull', **kwargs) try: op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction) except error.BundleValueError, exc: raise util.Abort('missing support for %s' % exc)
def _pushb2obsmarkers(pushop, bundler): if 'obsmarkers' in pushop.stepsdone: return remoteversions = bundle2.obsmarkersversion(bundler.capabilities) if obsolete.commonversion(remoteversions) is None: return pushop.stepsdone.add('obsmarkers') if pushop.outobsmarkers: buildobsmarkerspart(bundler, pushop.outobsmarkers)
def buildobsmarkerspart(bundler, markers): """add an obsmarker part to the bundler with <markers> No part is created if markers is empty. Raises ValueError if the bundler doesn't support any known obsmarker format. """ if markers: remoteversions = bundle2.obsmarkersversion(bundler.capabilities) version = obsolete.commonversion(remoteversions) if version is None: raise ValueError('bundler do not support common obsmarker format') stream = obsolete.encodemarkers(markers, True, version=version) return bundler.newpart('B2X:OBSMARKERS', data=stream) return None