Mercurial > public > mercurial-scm > hg
comparison mercurial/bundle2.py @ 33040:2baef42a2881
bundle: make applybundle1() return a bundleoperation
See previous commit for motivation. It already lets us share a little
bit more code in commands.py.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 21 Jun 2017 21:08:48 -0700 |
parents | b82615afde65 |
children | 18c2489ac96d |
comparison
equal
deleted
inserted
replaced
33039:b82615afde65 | 33040:2baef42a2881 |
---|---|
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 | 312 |
313 def applybundle1(repo, cg, tr, source, url, **kwargs): | 313 def applybundle1(repo, cg, tr, source, url, **kwargs): |
314 ret, addednodes = cg.apply(repo, tr, source, url, **kwargs) | 314 # the transactiongetter won't be used, but we might as well set it |
315 return ret | 315 op = bundleoperation(repo, lambda: tr) |
316 _processchangegroup(op, cg, tr, source, url, **kwargs) | |
317 return op | |
316 | 318 |
317 def applybundle(repo, unbundler, tr, source=None, url=None): | 319 def applybundle(repo, unbundler, tr, source=None, url=None): |
318 # transform me into unbundler.apply() as soon as the freeze is lifted | 320 # transform me into unbundler.apply() as soon as the freeze is lifted |
319 tr.hookargs['bundle2'] = '1' | 321 tr.hookargs['bundle2'] = '1' |
320 if source is not None and 'source' not in tr.hookargs: | 322 if source is not None and 'source' not in tr.hookargs: |