comparison mercurial/bundle2.py @ 33039:b82615afde65

bundle: add a applybundle1() method This is one step towards removing a bunch of "if isinstance(gen, unbundle20)" by treating bundle1 and bundle2 more similarly. The name may sounds ironic for a method in the bundle2 module, but I didn't think it was worth it yet to create a new 'bundle' module that depends on the 'bundle2' module. Besides, we'll inline the method again later.
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 16 Jun 2017 10:25:11 -0700
parents f0efd2bffe1e
children 2baef42a2881
comparison
equal deleted inserted replaced
33038:f0efd2bffe1e 33039:b82615afde65
307 """default method to get a transaction while processing a bundle 307 """default method to get a transaction while processing a bundle
308 308
309 Raise an exception to highlight the fact that no transaction was expected 309 Raise an exception to highlight the fact that no transaction was expected
310 to be created""" 310 to be created"""
311 raise TransactionUnavailable() 311 raise TransactionUnavailable()
312
313 def applybundle1(repo, cg, tr, source, url, **kwargs):
314 ret, addednodes = cg.apply(repo, tr, source, url, **kwargs)
315 return ret
312 316
313 def applybundle(repo, unbundler, tr, source=None, url=None): 317 def applybundle(repo, unbundler, tr, source=None, url=None):
314 # transform me into unbundler.apply() as soon as the freeze is lifted 318 # transform me into unbundler.apply() as soon as the freeze is lifted
315 tr.hookargs['bundle2'] = '1' 319 tr.hookargs['bundle2'] = '1'
316 if source is not None and 'source' not in tr.hookargs: 320 if source is not None and 'source' not in tr.hookargs: