comparison mercurial/exchange.py @ 33052: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
33051:b82615afde65 33052:2baef42a2881
1446 raise error.Abort(_("partial pull cannot be done because " 1446 raise error.Abort(_("partial pull cannot be done because "
1447 "other repository doesn't support " 1447 "other repository doesn't support "
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
1456 if 'phases' in pullop.stepsdone: 1457 if 'phases' in pullop.stepsdone:
1457 return 1458 return
1735 # push can proceed 1736 # push can proceed
1736 if not isinstance(cg, bundle2.unbundle20): 1737 if not isinstance(cg, bundle2.unbundle20):
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:
1744 def gettransaction(): 1746 def gettransaction():
1745 if not lockandtr[2]: 1747 if not lockandtr[2]: