@@ -255,71 +255,48 @@
# functionality from an ellipses enabled server
ellipsesremote = wireprototypes.ELLIPSESCAP in remote.capabilities()
- def pullbundle2extraprepare_widen(orig, pullop, kwargs):
- orig(pullop, kwargs)
- # The old{in,ex}cludepats have already been set by orig()
- kwargs['includepats'] = newincludes
- kwargs['excludepats'] = newexcludes
- wrappedextraprepare = extensions.wrappedfunction(exchange,
- '_pullbundle2extraprepare', pullbundle2extraprepare_widen)
-
# define a function that narrowbundle2 can call after creating the
# backup bundle, but before applying the bundle from the server
def setnewnarrowpats():
repo.setnarrowpats(newincludes, newexcludes)
repo.setnewnarrowpats = setnewnarrowpats
# silence the devel-warning of applying an empty changegroup
overrides = {('devel', 'all-warnings'): False}
+ bundle = None
+ known = []
+ common = commoninc[0]
with ui.uninterruptible():
- common = commoninc[0]
if ellipsesremote:
ds = repo.dirstate
p1, p2 = ds.p1(), ds.p2()
with ds.parentchange():
ds.setparents(node.nullid, node.nullid)
- with wrappedextraprepare:
- known = [node.hex(ctx.node()) for ctx in
- repo.set('::%ln', common)
- if ctx.node() != node.nullid]
+ known = [node.hex(ctx.node()) for ctx in
+ repo.set('::%ln', common)
+ if ctx.node() != node.nullid]
- with remote.commandexecutor() as e:
- bundle = e.callcommand('narrow_widen', {
- 'oldincludes': oldincludes,
- 'oldexcludes': oldexcludes,
- 'newincludes': newincludes,
- 'newexcludes': newexcludes,
- 'cgversion': '03',
- 'commonheads': common,
- 'known': known,
- 'ellipses': True,
- }).result()
- trmanager = exchange.transactionmanager(repo, 'widen', remote.url())
- with trmanager:
- op = bundle2.bundleoperation(repo,
- trmanager.transaction, source='widen')
- bundle2.processbundle(repo, bundle, op=op)
+ with remote.commandexecutor() as e:
+ bundle = e.callcommand('narrow_widen', {
+ 'oldincludes': oldincludes,
+ 'oldexcludes': oldexcludes,
+ 'newincludes': newincludes,
+ 'newexcludes': newexcludes,
+ 'cgversion': '03',
+ 'commonheads': common,
+ 'known': known,
+ 'ellipses': ellipsesremote,
+ }).result()
+ trmanager = exchange.transactionmanager(repo, 'widen', remote.url())
+ with trmanager, repo.ui.configoverride(overrides, 'widen'):
+ op = bundle2.bundleoperation(repo, trmanager.transaction,
+ source='widen')
+ # TODO: we should catch error.Abort here
+ bundle2.processbundle(repo, bundle, op=op)
+ if ellipsesremote:
with ds.parentchange():
ds.setparents(p1, p2)
- else:
- with remote.commandexecutor() as e:
- bundle = e.callcommand('narrow_widen', {
- 'oldincludes': oldincludes,
- 'oldexcludes': oldexcludes,
- 'newincludes': newincludes,
- 'newexcludes': newexcludes,
- 'cgversion': '03',
- 'commonheads': common,
- 'known': [],
- 'ellipses': False,
- }).result()
-
- with repo.transaction('widening') as tr:
- with repo.ui.configoverride(overrides, 'widen'):
- tgetter = lambda: tr
- bundle2.processbundle(repo, bundle,
- transactiongetter=tgetter)
with repo.transaction('widening'):
repo.setnewnarrowpats()