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 |
|
|
87 | lock = repo.lock() | |
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 |
|
|
102 | lock.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 |
|
|
120 | lock = repo.lock() | |
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 |
|
|
126 | lock.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 |
|
|
165 | lock = repo.lock() | |
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 |
|
|
179 | lock.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 = destlock = dircleanup = None |
|
282 | srclock = destwlock = destlock = dircleanup = None | |
283 | try: |
|
283 | try: | |
284 | abspath = origsource |
|
284 | abspath = origsource | |
285 | if islocal(origsource): |
|
285 | if islocal(origsource): | |
@@ -325,6 +325,11 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() | |||
328 | srcrepo.hook('outgoing', source='clone', |
|
333 | srcrepo.hook('outgoing', source='clone', | |
329 | node=node.hex(node.nullid)) |
|
334 | node=node.hex(node.nullid)) | |
330 | else: |
|
335 | else: | |
@@ -401,7 +406,7 b' def clone(ui, peeropts, source, dest=Non' | |||||
401 |
|
406 | |||
402 | return srcrepo, destrepo |
|
407 | return srcrepo, destrepo | |
403 | finally: |
|
408 | finally: | |
404 | release(srclock, destlock) |
|
409 | release(srclock, destlock, destwlock) | |
405 | if dircleanup is not None: |
|
410 | if dircleanup is not None: | |
406 | dircleanup.cleanup() |
|
411 | dircleanup.cleanup() | |
407 |
|
412 |
General Comments 0
You need to be logged in to leave comments.
Login now