Details
Details
- Reviewers
 indygreg - Group Reviewers
 hg-reviewers - Commits
 - rHG389f7b17ffb3: exchange: simplify unbundle locking using context managers
 
Diff Detail
Diff Detail
- Repository
 - rHG Mercurial
 - Lint
 Lint Skipped - Unit
 Unit Tests Skipped 
| indygreg | 
| hg-reviewers | 
| Lint Skipped | 
| Unit Tests Skipped | 
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/exchange.py (14 lines) | 
| Status | Author | Revision | |
|---|---|---|---|
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | 
| if err.errno != errno.EACCES: | if err.errno != errno.EACCES: | ||||
| raise | raise | ||||
| # source repo cannot be locked. | # source repo cannot be locked. | ||||
| # We do not abort the push, but just disable the local phase | # We do not abort the push, but just disable the local phase | ||||
| # synchronisation. | # synchronisation. | ||||
| msg = 'cannot lock source repository: %s\n' % err | msg = 'cannot lock source repository: %s\n' % err | ||||
| pushop.ui.debug(msg) | pushop.ui.debug(msg) | ||||
| try: | with wlock or util.nullcontextmanager(), \ | ||||
| lock or util.nullcontextmanager(), \ | |||||
| pushop.trmanager or util.nullcontextmanager(): | |||||
| pushop.repo.checkpush(pushop) | pushop.repo.checkpush(pushop) | ||||
| _pushdiscovery(pushop) | _pushdiscovery(pushop) | ||||
| if not _forcebundle1(pushop): | if not _forcebundle1(pushop): | ||||
| _pushbundle2(pushop) | _pushbundle2(pushop) | ||||
| _pushchangeset(pushop) | _pushchangeset(pushop) | ||||
| _pushsyncphase(pushop) | _pushsyncphase(pushop) | ||||
| _pushobsolete(pushop) | _pushobsolete(pushop) | ||||
| _pushbookmark(pushop) | _pushbookmark(pushop) | ||||
| if pushop.trmanager: | |||||
| pushop.trmanager.close() | |||||
| finally: | |||||
| if pushop.trmanager: | |||||
| pushop.trmanager.release() | |||||
| if lock is not None: | |||||
| lock.release() | |||||
| if wlock is not None: | |||||
| wlock.release() | |||||
| return pushop | return pushop | ||||
| # list of steps to perform discovery before push | # list of steps to perform discovery before push | ||||
| pushdiscoveryorder = [] | pushdiscoveryorder = [] | ||||
| # Mapping between step name and function | # Mapping between step name and function | ||||
| # | # | ||||
| # This exists to help extensions wrap steps if necessary | # This exists to help extensions wrap steps if necessary | ||||