Mercurial > public > mercurial-scm > hg-stable
diff mercurial/exchange.py @ 41769: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 |
line wrap: on
line diff
--- a/mercurial/exchange.py Wed Feb 20 19:28:51 2019 -0500 +++ b/mercurial/exchange.py Wed Feb 20 18:02:28 2019 -0500 @@ -556,18 +556,18 @@ % stringutil.forcebytestr(err)) pushop.ui.debug(msg) - with wlock or util.nullcontextmanager(), \ - lock or util.nullcontextmanager(), \ - pushop.trmanager or util.nullcontextmanager(): - pushop.repo.checkpush(pushop) - _checkpublish(pushop) - _pushdiscovery(pushop) - if not _forcebundle1(pushop): - _pushbundle2(pushop) - _pushchangeset(pushop) - _pushsyncphase(pushop) - _pushobsolete(pushop) - _pushbookmark(pushop) + with wlock or util.nullcontextmanager(): + with lock or util.nullcontextmanager(): + with pushop.trmanager or util.nullcontextmanager(): + pushop.repo.checkpush(pushop) + _checkpublish(pushop) + _pushdiscovery(pushop) + if not _forcebundle1(pushop): + _pushbundle2(pushop) + _pushchangeset(pushop) + _pushsyncphase(pushop) + _pushobsolete(pushop) + _pushbookmark(pushop) if repo.ui.configbool('experimental', 'remotenames'): logexchange.pullremotenames(repo, remote)