Mercurial > public > mercurial-scm > hg
comparison mercurial/exchange.py @ 51630:429d57227e7f stable
exchange: fix locking to actually be scoped
The previous code was taking locks before entering with statements, so
exception before the with statement would not release the lock (except for
garbage collection).
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 11 Jun 2024 11:13:36 +0200 |
parents | 7752cf4f64cc |
children | 3b69324d9535 |
comparison
equal
deleted
inserted
replaced
51626:eb11153c1698 | 51630:429d57227e7f |
---|---|
1692 ) | 1692 ) |
1693 % pycompat.bytestr(category) | 1693 % pycompat.bytestr(category) |
1694 ) | 1694 ) |
1695 | 1695 |
1696 pullop.trmanager = transactionmanager(repo, b'pull', remote.url()) | 1696 pullop.trmanager = transactionmanager(repo, b'pull', remote.url()) |
1697 wlock = util.nullcontextmanager() | 1697 wlock = util.nullcontextmanager |
1698 if not bookmod.bookmarksinstore(repo): | 1698 if not bookmod.bookmarksinstore(repo): |
1699 wlock = repo.wlock() | 1699 wlock = repo.wlock |
1700 with wlock, repo.lock(), pullop.trmanager: | 1700 with wlock(), repo.lock(), pullop.trmanager: |
1701 if confirm or ( | 1701 if confirm or ( |
1702 repo.ui.configbool(b"pull", b"confirm") and not repo.ui.plain() | 1702 repo.ui.configbool(b"pull", b"confirm") and not repo.ui.plain() |
1703 ): | 1703 ): |
1704 add_confirm_callback(repo, pullop) | 1704 add_confirm_callback(repo, pullop) |
1705 | 1705 |