##// END OF EJS Templates
unbundle: acquire 'wlock' when processing bundle2 (BC) (issue4596)...
Pierre-Yves David -
r24752:5640efd1 default
parent child Browse files
Show More
@@ -10,6 +10,7 b' from node import hex, nullid'
10 import errno, urllib
10 import errno, urllib
11 import util, scmutil, changegroup, base85, error
11 import util, scmutil, changegroup, base85, error
12 import discovery, phases, obsolete, bookmarks as bookmod, bundle2, pushkey
12 import discovery, phases, obsolete, bookmarks as bookmod, bundle2, pushkey
13 import lock as lockmod
13
14
14 def readbundle(ui, fh, fname, vfs=None):
15 def readbundle(ui, fh, fname, vfs=None):
15 header = changegroup.readexactly(fh, 4)
16 header = changegroup.readexactly(fh, 4)
@@ -1275,13 +1276,14 b' def unbundle(repo, cg, heads, source, ur'
1275 If the push was raced as PushRaced exception is raised."""
1276 If the push was raced as PushRaced exception is raised."""
1276 r = 0
1277 r = 0
1277 # need a transaction when processing a bundle2 stream
1278 # need a transaction when processing a bundle2 stream
1278 tr = None
1279 wlock = lock = tr = None
1279 lock = repo.lock()
1280 try:
1280 try:
1281 check_heads(repo, heads, 'uploading changes')
1281 check_heads(repo, heads, 'uploading changes')
1282 # push can proceed
1282 # push can proceed
1283 if util.safehasattr(cg, 'params'):
1283 if util.safehasattr(cg, 'params'):
1284 try:
1284 try:
1285 wlock = repo.wlock()
1286 lock = repo.lock()
1285 tr = repo.transaction(source)
1287 tr = repo.transaction(source)
1286 tr.hookargs['source'] = source
1288 tr.hookargs['source'] = source
1287 tr.hookargs['url'] = url
1289 tr.hookargs['url'] = url
@@ -1292,9 +1294,8 b' def unbundle(repo, cg, heads, source, ur'
1292 exc.duringunbundle2 = True
1294 exc.duringunbundle2 = True
1293 raise
1295 raise
1294 else:
1296 else:
1297 lock = repo.lock()
1295 r = changegroup.addchangegroup(repo, cg, source, url)
1298 r = changegroup.addchangegroup(repo, cg, source, url)
1296 finally:
1299 finally:
1297 if tr is not None:
1300 lockmod.release(tr, lock, wlock)
1298 tr.release()
1299 lock.release()
1300 return r
1301 return r
@@ -226,7 +226,6 b' push'
226 remote: adding file changes
226 remote: adding file changes
227 remote: added 1 changesets with 0 changes to 0 files (-1 heads)
227 remote: added 1 changesets with 0 changes to 0 files (-1 heads)
228 remote: 1 new obsolescence markers
228 remote: 1 new obsolescence markers
229 remote: "wlock" acquired after "lock" at: */mercurial/bookmarks.py:259 (pushbookmark) (glob)
230 updating bookmark book_eea1
229 updating bookmark book_eea1
231 pre-close-tip:02de42196ebe draft book_02de
230 pre-close-tip:02de42196ebe draft book_02de
232 postclose-tip:02de42196ebe draft book_02de
231 postclose-tip:02de42196ebe draft book_02de
@@ -305,7 +304,6 b' push over ssh'
305 remote: adding file changes
304 remote: adding file changes
306 remote: added 1 changesets with 1 changes to 1 files
305 remote: added 1 changesets with 1 changes to 1 files
307 remote: 1 new obsolescence markers
306 remote: 1 new obsolescence markers
308 remote: "wlock" acquired after "lock" at: */mercurial/bookmarks.py:259 (pushbookmark) (glob)
309 updating bookmark book_5fdd
307 updating bookmark book_5fdd
310 remote: pre-close-tip:5fddd98957c8 draft book_5fdd
308 remote: pre-close-tip:5fddd98957c8 draft book_5fdd
311 remote: pushkey: lock state after "bookmarks"
309 remote: pushkey: lock state after "bookmarks"
@@ -357,7 +355,6 b' push over http'
357 remote: adding file changes
355 remote: adding file changes
358 remote: added 1 changesets with 1 changes to 1 files
356 remote: added 1 changesets with 1 changes to 1 files
359 remote: 1 new obsolescence markers
357 remote: 1 new obsolescence markers
360 remote: "wlock" acquired after "lock" at: */mercurial/bookmarks.py:259 (pushbookmark) (glob)
361 updating bookmark book_32af
358 updating bookmark book_32af
362 pre-close-tip:02de42196ebe draft book_02de
359 pre-close-tip:02de42196ebe draft book_02de
363 postclose-tip:02de42196ebe draft book_02de
360 postclose-tip:02de42196ebe draft book_02de
General Comments 0
You need to be logged in to leave comments. Login now