Mercurial > public > mercurial-scm > hg
comparison mercurial/exchange.py @ 41760:1eb2fc21da12
cleanup: prefer nested context managers to \-continuations
I'd prefer Python accept a tuple of context managers, but alas it
isn't meant to be. This will have to suffice.
Differential Revision: https://phab.mercurial-scm.org/D5994
author | Augie Fackler <augie@google.com> |
---|---|
date | Wed, 20 Feb 2019 18:02:28 -0500 |
parents | aaad36b88298 |
children | 566daffc607d |
comparison
equal
deleted
inserted
replaced
41759:aaad36b88298 | 41760:1eb2fc21da12 |
---|---|
554 # synchronisation. | 554 # synchronisation. |
555 msg = ('cannot lock source repository: %s\n' | 555 msg = ('cannot lock source repository: %s\n' |
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) |
574 | 574 |
575 return pushop | 575 return pushop |