##// END OF EJS Templates
unshare: use context manager for locks...
Martin von Zweigbergk -
r41436:bc843e25 default
parent child Browse files
Show More
@@ -282,25 +282,20 b' def unshare(ui, repo):'
282 282 called.
283 283 """
284 284
285 destlock = None
286 lock = repo.lock()
287 try:
285 with repo.lock():
288 286 # we use locks here because if we race with commit, we
289 287 # can end up with extra data in the cloned revlogs that's
290 288 # not pointed to by changesets, thus causing verify to
291 289 # fail
292
293 290 destlock = copystore(ui, repo, repo.path)
294
295 sharefile = repo.vfs.join('sharedpath')
296 util.rename(sharefile, sharefile + '.old')
291 with destlock or util.nullcontextmanager():
297 292
298 repo.requirements.discard('shared')
299 repo.requirements.discard('relshared')
300 repo._writerequirements()
301 finally:
302 destlock and destlock.release()
303 lock and lock.release()
293 sharefile = repo.vfs.join('sharedpath')
294 util.rename(sharefile, sharefile + '.old')
295
296 repo.requirements.discard('shared')
297 repo.requirements.discard('relshared')
298 repo._writerequirements()
304 299
305 300 # Removing share changes some fundamental properties of the repo instance.
306 301 # So we instantiate a new repo object and operate on it rather than
General Comments 0
You need to be logged in to leave comments. Login now