comparison mercurial/exchange.py @ 30068:a76d5ba7ac43

pull: grab wlock during pull because pull might move bookmarks and bookmark are protected by wlock, we have to grab wlock for pull :-( This required a small upgrade of the 'lockdelay' extension used by 'test-clone.t' because the delay must apply to a single lock only.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 23 Aug 2016 23:47:59 +0200
parents 8d226db31f20
children 3e86261bf110
comparison
equal deleted inserted replaced
30067:6e88cd060ba2 30068:a76d5ba7ac43
1199 msg = _("required features are not" 1199 msg = _("required features are not"
1200 " supported in the destination:" 1200 " supported in the destination:"
1201 " %s") % (', '.join(sorted(missing))) 1201 " %s") % (', '.join(sorted(missing)))
1202 raise error.Abort(msg) 1202 raise error.Abort(msg)
1203 1203
1204 lock = pullop.repo.lock() 1204 wlock = lock = None
1205 try: 1205 try:
1206 wlock = pullop.repo.wlock()
1207 lock = pullop.repo.lock()
1206 pullop.trmanager = transactionmanager(repo, 'pull', remote.url()) 1208 pullop.trmanager = transactionmanager(repo, 'pull', remote.url())
1207 streamclone.maybeperformlegacystreamclone(pullop) 1209 streamclone.maybeperformlegacystreamclone(pullop)
1208 # This should ideally be in _pullbundle2(). However, it needs to run 1210 # This should ideally be in _pullbundle2(). However, it needs to run
1209 # before discovery to avoid extra work. 1211 # before discovery to avoid extra work.
1210 _maybeapplyclonebundle(pullop) 1212 _maybeapplyclonebundle(pullop)
1215 _pullphase(pullop) 1217 _pullphase(pullop)
1216 _pullbookmarks(pullop) 1218 _pullbookmarks(pullop)
1217 _pullobsolete(pullop) 1219 _pullobsolete(pullop)
1218 pullop.trmanager.close() 1220 pullop.trmanager.close()
1219 finally: 1221 finally:
1220 pullop.trmanager.release() 1222 lockmod.release(pullop.trmanager, lock, wlock)
1221 lock.release()
1222 1223
1223 return pullop 1224 return pullop
1224 1225
1225 # list of steps to perform discovery before pull 1226 # list of steps to perform discovery before pull
1226 pulldiscoveryorder = [] 1227 pulldiscoveryorder = []