infinitepush: only open a transaction when deleting bookmarks

Summary: There is no need to open a transaction otherwise.

Reviewed By: DurhamG

Differential Revision: D20109840

fbshipit-source-id: e47adaaeea2d7565f3629701d8de4a67d4b55182
This commit is contained in:
Xavier Deguillard 2020-02-26 10:24:03 -08:00 committed by Facebook Github Bot
parent f6d95a9977
commit 76dd52a310

View File

@ -277,7 +277,7 @@ def _bookmarks(orig, ui, repo, *names, **opts):
delete = opts.get("delete")
remotepath = opts.get("remote_path")
path = ui.paths.getpath(remotepath or None, default=("default"))
with repo.wlock(), repo.lock(), repo.transaction("bookmarks"):
if pattern:
destpath = path.pushloc or path.loc
other = hg.peer(repo, opts, destpath)
@ -291,6 +291,7 @@ def _bookmarks(orig, ui, repo, *names, **opts):
_showbookmarks(ui, fetchedbookmarks, **opts)
return
elif delete and "remotenames" in extensions._extensions:
with repo.wlock(), repo.lock(), repo.transaction("bookmarks"):
existing_local_bms = set(repo._bookmarks.keys())
scratch_bms = []
other_bms = []