##// END OF EJS Templates
bundle: add a applybundle1() method...
Martin von Zweigbergk -
r33039:b82615af default
parent child Browse files
Show More
@@ -1199,7 +1199,9 b' def _aborthistedit(ui, repo, state):'
1199 gen = exchange.readbundle(ui, f, backupfile)
1199 gen = exchange.readbundle(ui, f, backupfile)
1200 with repo.transaction('histedit.abort') as tr:
1200 with repo.transaction('histedit.abort') as tr:
1201 if not isinstance(gen, bundle2.unbundle20):
1201 if not isinstance(gen, bundle2.unbundle20):
1202 gen.apply(repo, tr, 'histedit', 'bundle:' + backupfile)
1202 bundle2.applybundle1(repo, gen, tr,
1203 source='histedit',
1204 url='bundle:' + backupfile)
1203 else:
1205 else:
1204 bundle2.applybundle(repo, gen, tr,
1206 bundle2.applybundle(repo, gen, tr,
1205 source='histedit',
1207 source='histedit',
@@ -127,9 +127,11 b' class shelvedfile(object):'
127 try:
127 try:
128 gen = exchange.readbundle(self.repo.ui, fp, self.fname, self.vfs)
128 gen = exchange.readbundle(self.repo.ui, fp, self.fname, self.vfs)
129 if not isinstance(gen, bundle2.unbundle20):
129 if not isinstance(gen, bundle2.unbundle20):
130 gen.apply(self.repo, self.repo.currenttransaction(), 'unshelve',
130 bundle2.applybundle1(self.repo, gen,
131 'bundle:' + self.vfs.join(self.fname),
131 self.repo.currenttransaction(),
132 targetphase=phases.secret)
132 source='unshelve',
133 url='bundle:' + self.vfs.join(self.fname),
134 targetphase=phases.secret)
133 else:
135 else:
134 bundle2.applybundle(self.repo, gen,
136 bundle2.applybundle(self.repo, gen,
135 self.repo.currenttransaction(),
137 self.repo.currenttransaction(),
@@ -310,6 +310,10 b' def _notransaction():'
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):
314 ret, addednodes = cg.apply(repo, tr, source, url, **kwargs)
315 return ret
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'
@@ -5218,7 +5218,9 b' def unbundle(ui, repo, fname1, *fnames, '
5218 else:
5218 else:
5219 txnname = 'unbundle\n%s' % util.hidepassword(url)
5219 txnname = 'unbundle\n%s' % util.hidepassword(url)
5220 with repo.transaction(txnname) as tr:
5220 with repo.transaction(txnname) as tr:
5221 modheads, addednodes = gen.apply(repo, tr, 'unbundle', url)
5221 modheads = bundle2.applybundle1(repo, gen, tr,
5222 source='unbundle',
5223 url=url)
5222
5224
5223 return postincoming(ui, repo, modheads, opts.get(r'update'), None, None)
5225 return postincoming(ui, repo, modheads, opts.get(r'update'), None, None)
5224
5226
@@ -1448,7 +1448,7 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, addednodes = cg.apply(pullop.repo, tr, 'pull',
1451 pullop.cgresult = bundle2.applybundle1(pullop.repo, cg, tr, 'pull',
1452 pullop.remote.url())
1452 pullop.remote.url())
1453
1453
1454 def _pullphase(pullop):
1454 def _pullphase(pullop):
@@ -1737,7 +1737,7 b' def unbundle(repo, cg, heads, source, ur'
1737 # legacy case: bundle1 (changegroup 01)
1737 # legacy case: bundle1 (changegroup 01)
1738 txnname = "\n".join([source, util.hidepassword(url)])
1738 txnname = "\n".join([source, util.hidepassword(url)])
1739 with repo.lock(), repo.transaction(txnname) as tr:
1739 with repo.lock(), repo.transaction(txnname) as tr:
1740 r, addednodes = cg.apply(repo, tr, source, url)
1740 r = bundle2.applybundle1(repo, cg, tr, source, url)
1741 else:
1741 else:
1742 r = None
1742 r = None
1743 try:
1743 try:
@@ -2002,7 +2002,7 b' def trypullbundlefromurl(ui, repo, url):'
2002 elif isinstance(cg, streamclone.streamcloneapplier):
2002 elif isinstance(cg, streamclone.streamcloneapplier):
2003 cg.apply(repo)
2003 cg.apply(repo)
2004 else:
2004 else:
2005 cg.apply(repo, tr, 'clonebundles', url)
2005 bundle2.applybundle1(repo, cg, tr, 'clonebundles', url)
2006 return True
2006 return True
2007 except urlerr.httperror as e:
2007 except urlerr.httperror as e:
2008 ui.warn(_('HTTP error fetching bundle: %s\n') % str(e))
2008 ui.warn(_('HTTP error fetching bundle: %s\n') % str(e))
@@ -214,7 +214,8 b' def strip(ui, repo, nodelist, backup=Tru'
214 else:
214 else:
215 txnname = "strip\n%s" % util.hidepassword(tmpbundleurl)
215 txnname = "strip\n%s" % util.hidepassword(tmpbundleurl)
216 with repo.transaction(txnname) as tr:
216 with repo.transaction(txnname) as tr:
217 gen.apply(repo, tr, 'strip', tmpbundleurl, True)
217 bundle2.applybundle1(repo, gen, tr, 'strip', tmpbundleurl,
218 emptyok=True)
218 if not repo.ui.verbose:
219 if not repo.ui.verbose:
219 repo.ui.popbuffer()
220 repo.ui.popbuffer()
220 f.close()
221 f.close()
General Comments 0
You need to be logged in to leave comments. Login now