##// END OF EJS Templates
narrow: refactor code around widening complicated by previous patch...
Pulkit Goyal -
r42606:8381b706 default
parent child Browse files
Show More
@@ -278,42 +278,22 b' def _widen(ui, repo, remote, commoninc, '
278 # silence the devel-warning of applying an empty changegroup
278 # silence the devel-warning of applying an empty changegroup
279 overrides = {('devel', 'all-warnings'): False}
279 overrides = {('devel', 'all-warnings'): False}
280
280
281 common = commoninc[0]
281 with ui.uninterruptible():
282 with ui.uninterruptible():
282 common = commoninc[0]
283 if ellipsesremote:
283 if ellipsesremote:
284 ds = repo.dirstate
284 ds = repo.dirstate
285 p1, p2 = ds.p1(), ds.p2()
285 p1, p2 = ds.p1(), ds.p2()
286 with ds.parentchange():
286 with ds.parentchange():
287 ds.setparents(node.nullid, node.nullid)
287 ds.setparents(node.nullid, node.nullid)
288 if isoldellipses:
288 with wrappedextraprepare:
289 with wrappedextraprepare:
289 if isoldellipses:
290 exchange.pull(repo, remote, heads=common)
290 exchange.pull(repo, remote, heads=common)
291 else:
292 known = [node.hex(ctx.node()) for ctx in
293 repo.set('::%ln', common)
294 if ctx.node() != node.nullid]
295
296 with remote.commandexecutor() as e:
297 bundle = e.callcommand('narrow_widen', {
298 'oldincludes': oldincludes,
299 'oldexcludes': oldexcludes,
300 'newincludes': newincludes,
301 'newexcludes': newexcludes,
302 'cgversion': '03',
303 'commonheads': common,
304 'known': known,
305 'ellipses': True,
306 }).result()
307 trmanager = exchange.transactionmanager(repo, 'widen',
308 remote.url())
309 with trmanager:
310 op = bundle2.bundleoperation(repo,
311 trmanager.transaction, source='widen')
312 bundle2.processbundle(repo, bundle, op=op)
313
314 with ds.parentchange():
315 ds.setparents(p1, p2)
316 else:
291 else:
292 known = []
293 if ellipsesremote:
294 known = [node.hex(ctx.node()) for ctx in
295 repo.set('::%ln', common)
296 if ctx.node() != node.nullid]
317 with remote.commandexecutor() as e:
297 with remote.commandexecutor() as e:
318 bundle = e.callcommand('narrow_widen', {
298 bundle = e.callcommand('narrow_widen', {
319 'oldincludes': oldincludes,
299 'oldincludes': oldincludes,
@@ -322,15 +302,20 b' def _widen(ui, repo, remote, commoninc, '
322 'newexcludes': newexcludes,
302 'newexcludes': newexcludes,
323 'cgversion': '03',
303 'cgversion': '03',
324 'commonheads': common,
304 'commonheads': common,
325 'known': [],
305 'known': known,
326 'ellipses': False,
306 'ellipses': ellipsesremote,
327 }).result()
307 }).result()
328
308
329 with repo.transaction('widening') as tr:
309 trmanager = exchange.transactionmanager(repo, 'widen', remote.url())
330 with repo.ui.configoverride(overrides, 'widen'):
310 with trmanager, repo.ui.configoverride(overrides, 'widen'):
331 tgetter = lambda: tr
311 op = bundle2.bundleoperation(repo, trmanager.transaction,
332 bundle2.processbundle(repo, bundle,
312 source='widen')
333 transactiongetter=tgetter)
313 # TODO: we should catch error.Abort here
314 bundle2.processbundle(repo, bundle, op=op)
315
316 if ellipsesremote:
317 with ds.parentchange():
318 ds.setparents(p1, p2)
334
319
335 with repo.transaction('widening'):
320 with repo.transaction('widening'):
336 repo.setnewnarrowpats()
321 repo.setnewnarrowpats()
General Comments 0
You need to be logged in to leave comments. Login now