D6388: exchange: don't take wlock if bookmarks are stored in .hg/store/
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY If bookmarks are stored in .hg/store/, there is no need for the wlock(). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6388 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 @@ -539,10 +539,12 @@ # get lock as we might write phase data wlock = lock = None try: -# bundle2 push may receive a reply bundle touching bookmarks or other -# things requiring the wlock. Take it now to ensure proper ordering. +# bundle2 push may receive a reply bundle touching bookmarks +# requiring the wlock. Take it now to ensure proper ordering. maypushback = pushop.ui.configbool('experimental', 'bundle2.pushback') -if (not _forcebundle1(pushop)) and maypushback: +if ((not _forcebundle1(pushop)) and +maypushback and +not bookmod.bookmarksinstore(repo)): wlock = pushop.repo.wlock() lock = pushop.repo.lock() pushop.trmanager = transactionmanager(pushop.repo, @@ -1548,7 +1550,10 @@ raise error.Abort(msg) pullop.trmanager = transactionmanager(repo, 'pull', remote.url()) -with repo.wlock(), repo.lock(), pullop.trmanager: +wlock = util.nullcontextmanager() +if not bookmod.bookmarksinstore(repo): +wlock = repo.wlock() +with wlock, repo.lock(), pullop.trmanager: # Use the modern wire protocol, if available. if remote.capable('command-changesetdata'): exchangev2.pull(pullop) @@ -2395,7 +2400,8 @@ try: def gettransaction(): if not lockandtr[2]: -lockandtr[0] = repo.wlock() +if not bookmod.bookmarksinstore(repo): +lockandtr[0] = repo.wlock() lockandtr[1] = repo.lock() lockandtr[2] = repo.transaction(source) lockandtr[2].hookargs['source'] = source To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6388: exchange: don't take wlock if bookmarks are stored in .hg/store/
This revision was automatically updated to reflect the committed changes. Closed by commit rHG5d4ec64a6fcb: exchange: don't take wlock if bookmarks are stored in .hg/store/ (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6388?vs=15132&id=15167 REVISION DETAIL https://phab.mercurial-scm.org/D6388 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 @@ -539,10 +539,12 @@ # get lock as we might write phase data wlock = lock = None try: -# bundle2 push may receive a reply bundle touching bookmarks or other -# things requiring the wlock. Take it now to ensure proper ordering. +# bundle2 push may receive a reply bundle touching bookmarks +# requiring the wlock. Take it now to ensure proper ordering. maypushback = pushop.ui.configbool('experimental', 'bundle2.pushback') -if (not _forcebundle1(pushop)) and maypushback: +if ((not _forcebundle1(pushop)) and +maypushback and +not bookmod.bookmarksinstore(repo)): wlock = pushop.repo.wlock() lock = pushop.repo.lock() pushop.trmanager = transactionmanager(pushop.repo, @@ -1548,7 +1550,10 @@ raise error.Abort(msg) pullop.trmanager = transactionmanager(repo, 'pull', remote.url()) -with repo.wlock(), repo.lock(), pullop.trmanager: +wlock = util.nullcontextmanager() +if not bookmod.bookmarksinstore(repo): +wlock = repo.wlock() +with wlock, repo.lock(), pullop.trmanager: # Use the modern wire protocol, if available. if remote.capable('command-changesetdata'): exchangev2.pull(pullop) @@ -2395,7 +2400,8 @@ try: def gettransaction(): if not lockandtr[2]: -lockandtr[0] = repo.wlock() +if not bookmod.bookmarksinstore(repo): +lockandtr[0] = repo.wlock() lockandtr[1] = repo.lock() lockandtr[2] = repo.transaction(source) lockandtr[2].hookargs['source'] = source To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel