##// END OF EJS Templates
bundle: make applybundle1() return a bundleoperation...
Martin von Zweigbergk -
r33040:2baef42a default
parent child Browse files
Show More
@@ -311,8 +311,10 b' def _notransaction():'
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
@@ -5214,13 +5214,12 b' def unbundle(ui, repo, fname1, *fnames, '
5214 hint=_("see https://mercurial-scm.org/"
5214 hint=_("see https://mercurial-scm.org/"
5215 "wiki/BundleFeature for more "
5215 "wiki/BundleFeature for more "
5216 "information"))
5216 "information"))
5217 modheads = bundle2.combinechangegroupresults(op)
5218 else:
5217 else:
5219 txnname = 'unbundle\n%s' % util.hidepassword(url)
5218 txnname = 'unbundle\n%s' % util.hidepassword(url)
5220 with repo.transaction(txnname) as tr:
5219 with repo.transaction(txnname) as tr:
5221 modheads = bundle2.applybundle1(repo, gen, tr,
5220 op = bundle2.applybundle1(repo, gen, tr, source='unbundle',
5222 source='unbundle',
5221 url=url)
5223 url=url)
5222 modheads = bundle2.combinechangegroupresults(op)
5224
5223
5225 return postincoming(ui, repo, modheads, opts.get(r'update'), None, None)
5224 return postincoming(ui, repo, modheads, opts.get(r'update'), None, None)
5226
5225
@@ -1448,8 +1448,9 b' def _pullchangeset(pullop):'
1448 "changegroupsubset."))
1448 "changegroupsubset."))
1449 else:
1449 else:
1450 cg = pullop.remote.changegroupsubset(pullop.fetch, pullop.heads, 'pull')
1450 cg = pullop.remote.changegroupsubset(pullop.fetch, pullop.heads, 'pull')
1451 pullop.cgresult = bundle2.applybundle1(pullop.repo, cg, tr, 'pull',
1451 bundleop = bundle2.applybundle1(pullop.repo, cg, tr, 'pull',
1452 pullop.remote.url())
1452 pullop.remote.url())
1453 pullop.cgresult = bundle2.combinechangegroupresults(bundleop)
1453
1454
1454 def _pullphase(pullop):
1455 def _pullphase(pullop):
1455 # Get remote phases data from remote
1456 # Get remote phases data from remote
@@ -1737,7 +1738,8 b' def unbundle(repo, cg, heads, source, ur'
1737 # legacy case: bundle1 (changegroup 01)
1738 # legacy case: bundle1 (changegroup 01)
1738 txnname = "\n".join([source, util.hidepassword(url)])
1739 txnname = "\n".join([source, util.hidepassword(url)])
1739 with repo.lock(), repo.transaction(txnname) as tr:
1740 with repo.lock(), repo.transaction(txnname) as tr:
1740 r = bundle2.applybundle1(repo, cg, tr, source, url)
1741 op = bundle2.applybundle1(repo, cg, tr, source, url)
1742 r = bundle2.combinechangegroupresults(op)
1741 else:
1743 else:
1742 r = None
1744 r = None
1743 try:
1745 try:
General Comments 0
You need to be logged in to leave comments. Login now