280 |
280 |
281 The passed repository object is not usable after this function is |
281 The passed repository object is not usable after this function is |
282 called. |
282 called. |
283 """ |
283 """ |
284 |
284 |
285 destlock = None |
285 with repo.lock(): |
286 lock = repo.lock() |
|
287 try: |
|
288 # we use locks here because if we race with commit, we |
286 # we use locks here because if we race with commit, we |
289 # can end up with extra data in the cloned revlogs that's |
287 # can end up with extra data in the cloned revlogs that's |
290 # not pointed to by changesets, thus causing verify to |
288 # not pointed to by changesets, thus causing verify to |
291 # fail |
289 # fail |
292 |
|
293 destlock = copystore(ui, repo, repo.path) |
290 destlock = copystore(ui, repo, repo.path) |
294 |
291 with destlock or util.nullcontextmanager(): |
295 sharefile = repo.vfs.join('sharedpath') |
292 |
296 util.rename(sharefile, sharefile + '.old') |
293 sharefile = repo.vfs.join('sharedpath') |
297 |
294 util.rename(sharefile, sharefile + '.old') |
298 repo.requirements.discard('shared') |
295 |
299 repo.requirements.discard('relshared') |
296 repo.requirements.discard('shared') |
300 repo._writerequirements() |
297 repo.requirements.discard('relshared') |
301 finally: |
298 repo._writerequirements() |
302 destlock and destlock.release() |
|
303 lock and lock.release() |
|
304 |
299 |
305 # Removing share changes some fundamental properties of the repo instance. |
300 # Removing share changes some fundamental properties of the repo instance. |
306 # So we instantiate a new repo object and operate on it rather than |
301 # So we instantiate a new repo object and operate on it rather than |
307 # try to keep the existing repo usable. |
302 # try to keep the existing repo usable. |
308 newrepo = repository(repo.baseui, repo.root, create=False) |
303 newrepo = repository(repo.baseui, repo.root, create=False) |