##// END OF EJS Templates
cleanup: prefer nested context managers to \-continuations...
Augie Fackler -
r41926:1eb2fc21 default
parent child Browse files
Show More
@@ -664,9 +664,9 b' def overridecopy(orig, ui, repo, pats, o'
664 _('destination largefile already exists'))
664 _('destination largefile already exists'))
665 copiedfiles.append((src, dest))
665 copiedfiles.append((src, dest))
666 orig(src, dest, *args, **kwargs)
666 orig(src, dest, *args, **kwargs)
667 with extensions.wrappedfunction(util, 'copyfile', overridecopyfile), \
667 with extensions.wrappedfunction(util, 'copyfile', overridecopyfile):
668 extensions.wrappedfunction(scmutil, 'match', overridematch):
668 with extensions.wrappedfunction(scmutil, 'match', overridematch):
669 result += orig(ui, repo, listpats, opts, rename)
669 result += orig(ui, repo, listpats, opts, rename)
670
670
671 lfdirstate = lfutil.openlfdirstate(ui, repo)
671 lfdirstate = lfutil.openlfdirstate(ui, repo)
672 for (src, dest) in copiedfiles:
672 for (src, dest) in copiedfiles:
@@ -278,9 +278,9 b' def _widen(ui, repo, remote, commoninc, '
278 p1, p2 = ds.p1(), ds.p2()
278 p1, p2 = ds.p1(), ds.p2()
279 with ds.parentchange():
279 with ds.parentchange():
280 ds.setparents(node.nullid, node.nullid)
280 ds.setparents(node.nullid, node.nullid)
281 with wrappedextraprepare,\
281 with wrappedextraprepare:
282 repo.ui.configoverride(overrides, 'widen'):
282 with repo.ui.configoverride(overrides, 'widen'):
283 exchange.pull(repo, remote, heads=common)
283 exchange.pull(repo, remote, heads=common)
284 with ds.parentchange():
284 with ds.parentchange():
285 ds.setparents(p1, p2)
285 ds.setparents(p1, p2)
286 else:
286 else:
@@ -296,11 +296,11 b' def _widen(ui, repo, remote, commoninc, '
296 'ellipses': False,
296 'ellipses': False,
297 }).result()
297 }).result()
298
298
299 with repo.transaction('widening') as tr,\
299 with repo.transaction('widening') as tr:
300 repo.ui.configoverride(overrides, 'widen'):
300 with repo.ui.configoverride(overrides, 'widen'):
301 tgetter = lambda: tr
301 tgetter = lambda: tr
302 bundle2.processbundle(repo, bundle,
302 bundle2.processbundle(repo, bundle,
303 transactiongetter=tgetter)
303 transactiongetter=tgetter)
304
304
305 with repo.transaction('widening'):
305 with repo.transaction('widening'):
306 repo.setnewnarrowpats()
306 repo.setnewnarrowpats()
@@ -556,18 +556,18 b' def push(repo, remote, force=False, revs'
556 % stringutil.forcebytestr(err))
556 % stringutil.forcebytestr(err))
557 pushop.ui.debug(msg)
557 pushop.ui.debug(msg)
558
558
559 with wlock or util.nullcontextmanager(), \
559 with wlock or util.nullcontextmanager():
560 lock or util.nullcontextmanager(), \
560 with lock or util.nullcontextmanager():
561 pushop.trmanager or util.nullcontextmanager():
561 with pushop.trmanager or util.nullcontextmanager():
562 pushop.repo.checkpush(pushop)
562 pushop.repo.checkpush(pushop)
563 _checkpublish(pushop)
563 _checkpublish(pushop)
564 _pushdiscovery(pushop)
564 _pushdiscovery(pushop)
565 if not _forcebundle1(pushop):
565 if not _forcebundle1(pushop):
566 _pushbundle2(pushop)
566 _pushbundle2(pushop)
567 _pushchangeset(pushop)
567 _pushchangeset(pushop)
568 _pushsyncphase(pushop)
568 _pushsyncphase(pushop)
569 _pushobsolete(pushop)
569 _pushobsolete(pushop)
570 _pushbookmark(pushop)
570 _pushbookmark(pushop)
571
571
572 if repo.ui.configbool('experimental', 'remotenames'):
572 if repo.ui.configbool('experimental', 'remotenames'):
573 logexchange.pullremotenames(repo, remote)
573 logexchange.pullremotenames(repo, remote)
General Comments 0
You need to be logged in to leave comments. Login now