diff 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
line wrap: on
line diff
--- a/mercurial/exchange.py	Wed Aug 24 04:19:11 2016 +0200
+++ b/mercurial/exchange.py	Tue Aug 23 23:47:59 2016 +0200
@@ -1201,8 +1201,10 @@
                     " %s") % (', '.join(sorted(missing)))
             raise error.Abort(msg)
 
-    lock = pullop.repo.lock()
+    wlock = lock = None
     try:
+        wlock = pullop.repo.wlock()
+        lock = pullop.repo.lock()
         pullop.trmanager = transactionmanager(repo, 'pull', remote.url())
         streamclone.maybeperformlegacystreamclone(pullop)
         # This should ideally be in _pullbundle2(). However, it needs to run
@@ -1217,8 +1219,7 @@
         _pullobsolete(pullop)
         pullop.trmanager.close()
     finally:
-        pullop.trmanager.release()
-        lock.release()
+        lockmod.release(pullop.trmanager, lock, wlock)
 
     return pullop