##// END OF EJS Templates
bookmarks: backout locking change in 12dea4d998ec...
Matt Mackall -
r15908:60cb4f38 default
parent child Browse files
Show More
@@ -84,7 +84,7 b' def write(repo):'
84 raise util.Abort(_("bookmark '%s' contains illegal "
84 raise util.Abort(_("bookmark '%s' contains illegal "
85 "character" % mark))
85 "character" % mark))
86
86
87 lock = repo.lock()
87 wlock = repo.wlock()
88 try:
88 try:
89
89
90 file = repo.opener('bookmarks', 'w', atomictemp=True)
90 file = repo.opener('bookmarks', 'w', atomictemp=True)
@@ -99,7 +99,7 b' def write(repo):'
99 pass
99 pass
100
100
101 finally:
101 finally:
102 lock.release()
102 wlock.release()
103
103
104 def setcurrent(repo, mark):
104 def setcurrent(repo, mark):
105 '''Set the name of the bookmark that we are currently on
105 '''Set the name of the bookmark that we are currently on
@@ -117,13 +117,13 b' def setcurrent(repo, mark):'
117 raise util.Abort(_("bookmark '%s' contains illegal "
117 raise util.Abort(_("bookmark '%s' contains illegal "
118 "character" % mark))
118 "character" % mark))
119
119
120 lock = repo.lock()
120 wlock = repo.wlock()
121 try:
121 try:
122 file = repo.opener('bookmarks.current', 'w', atomictemp=True)
122 file = repo.opener('bookmarks.current', 'w', atomictemp=True)
123 file.write(encoding.fromlocal(mark))
123 file.write(encoding.fromlocal(mark))
124 file.close()
124 file.close()
125 finally:
125 finally:
126 lock.release()
126 wlock.release()
127 repo._bookmarkcurrent = mark
127 repo._bookmarkcurrent = mark
128
128
129 def updatecurrentbookmark(repo, oldnode, curbranch):
129 def updatecurrentbookmark(repo, oldnode, curbranch):
@@ -162,7 +162,7 b' def listbookmarks(repo):'
162 return d
162 return d
163
163
164 def pushbookmark(repo, key, old, new):
164 def pushbookmark(repo, key, old, new):
165 lock = repo.lock()
165 w = repo.wlock()
166 try:
166 try:
167 marks = repo._bookmarks
167 marks = repo._bookmarks
168 if hex(marks.get(key, '')) != old:
168 if hex(marks.get(key, '')) != old:
@@ -176,7 +176,7 b' def pushbookmark(repo, key, old, new):'
176 write(repo)
176 write(repo)
177 return True
177 return True
178 finally:
178 finally:
179 lock.release()
179 w.release()
180
180
181 def updatefromremote(ui, repo, remote, path):
181 def updatefromremote(ui, repo, remote, path):
182 ui.debug("checking for updated bookmarks\n")
182 ui.debug("checking for updated bookmarks\n")
@@ -279,7 +279,7 b' def clone(ui, peeropts, source, dest=Non'
279 if self.dir_:
279 if self.dir_:
280 self.rmtree(self.dir_, True)
280 self.rmtree(self.dir_, True)
281
281
282 srclock = destwlock = destlock = dircleanup = None
282 srclock = destlock = dircleanup = None
283 try:
283 try:
284 abspath = origsource
284 abspath = origsource
285 if islocal(origsource):
285 if islocal(origsource):
@@ -325,11 +325,6 b' def clone(ui, peeropts, source, dest=Non'
325 # we need to re-init the repo after manually copying the data
325 # we need to re-init the repo after manually copying the data
326 # into it
326 # into it
327 destrepo = repository(remoteui(ui, peeropts), dest)
327 destrepo = repository(remoteui(ui, peeropts), dest)
328 # we need full recursive locking of the new repo instance
329 destwlock = destrepo.wlock()
330 if destlock:
331 destlock.release() # a little race condition - but no deadlock
332 destlock = destrepo.lock()
333 srcrepo.hook('outgoing', source='clone',
328 srcrepo.hook('outgoing', source='clone',
334 node=node.hex(node.nullid))
329 node=node.hex(node.nullid))
335 else:
330 else:
@@ -406,7 +401,7 b' def clone(ui, peeropts, source, dest=Non'
406
401
407 return srcrepo, destrepo
402 return srcrepo, destrepo
408 finally:
403 finally:
409 release(srclock, destlock, destwlock)
404 release(srclock, destlock)
410 if dircleanup is not None:
405 if dircleanup is not None:
411 dircleanup.cleanup()
406 dircleanup.cleanup()
412
407
General Comments 0
You need to be logged in to leave comments. Login now