Skip to content
Snippets Groups Projects
Commit 5dc5cd7a authored by Pierre-Yves David's avatar Pierre-Yves David
Browse files

push: acquire local 'wlock' if "pushback" is expected (BC) (issue4596)

If the client allows "pushback", the bundle2 served back by the server may
contains parts that will write to the repository. Such parts may require the
'wlock' (eg: bookmark) so we acquire it in advance to make sure it got acquired
before the 'lock'.
parent 5640efd1
No related branches found
Tags 2.2.1
No related merge requests found
......@@ -201,5 +201,5 @@
if not pushop.remote.canpush():
raise util.Abort(_("destination does not support push"))
# get local lock as we might write phase data
locallock = None
localwlock = locallock = None
try:
......@@ -205,4 +205,9 @@
try:
# bundle2 push may receive a reply bundle touching bookmarks or other
# things requiring the wlock. Take it now to ensure proper ordering.
maypushback = pushop.ui.configbool('experimental', 'bundle2.pushback')
if _canusebundle2(pushop) and maypushback:
localwlock = pushop.repo.wlock()
locallock = pushop.repo.lock()
pushop.locallocked = True
except IOError, err:
......@@ -242,6 +247,8 @@
pushop.trmanager.release()
if locallock is not None:
locallock.release()
if localwlock is not None:
localwlock.release()
return pushop
......
......@@ -91,7 +91,6 @@
$ hg push
pushing to ssh://user@dummy/server
searching for changes
"wlock" acquired after "lock" at: */mercurial/bookmarks.py:259 (pushbookmark) (glob)
remote: adding changesets
remote: adding manifests
remote: adding file changes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment