D1841: exchange: use context manager for locks and transaction in unbundle()
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Wed Jan 10 18:03:37 EST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG86f9aabed67b: exchange: use context manager for locks and transaction in unbundle() (authored by martinvonz, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D1841?vs=4761&id=4771
REVISION DETAIL
https://phab.mercurial-scm.org/D1841
AFFECTED FILES
mercurial/exchange.py
CHANGE DETAILS
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1345,11 +1345,8 @@
" %s") % (', '.join(sorted(missing)))
raise error.Abort(msg)
- wlock = lock = None
- try:
- wlock = pullop.repo.wlock()
- lock = pullop.repo.lock()
- pullop.trmanager = transactionmanager(repo, 'pull', remote.url())
+ pullop.trmanager = transactionmanager(repo, 'pull', remote.url())
+ with repo.wlock(), repo.lock(), pullop.trmanager:
# This should ideally be in _pullbundle2(). However, it needs to run
# before discovery to avoid extra work.
_maybeapplyclonebundle(pullop)
@@ -1361,9 +1358,6 @@
_pullphase(pullop)
_pullbookmarks(pullop)
_pullobsolete(pullop)
- pullop.trmanager.close()
- finally:
- lockmod.release(pullop.trmanager, lock, wlock)
# storing remotenames
if repo.ui.configbool('experimental', 'remotenames'):
To: martinvonz, #hg-reviewers, durin42
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list