diff hgext/share.py @ 34878:9f7ecc5bbc28

share: move the implementation of 'unshare' to the 'hg' module This will be used to setup unsharing subrepos. Usually cmdutil is used for this purpose. But the implementation needs hg.copystore(), and the hg module already imports cmdutil.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 17 Oct 2017 21:48:56 -0400
parents 68e0bcb90357
children ff178743e59b
line wrap: on
line diff
--- a/hgext/share.py	Tue Oct 17 20:25:43 2017 +0200
+++ b/hgext/share.py	Tue Oct 17 21:48:56 2017 -0400
@@ -114,28 +114,7 @@
     if not repo.shared():
         raise error.Abort(_("this is not a shared repo"))
 
-    destlock = lock = None
-    lock = repo.lock()
-    try:
-        # we use locks here because if we race with commit, we
-        # can end up with extra data in the cloned revlogs that's
-        # not pointed to by changesets, thus causing verify to
-        # fail
-
-        destlock = hg.copystore(ui, repo, repo.path)
-
-        sharefile = repo.vfs.join('sharedpath')
-        util.rename(sharefile, sharefile + '.old')
-
-        repo.requirements.discard('shared')
-        repo.requirements.discard('relshared')
-        repo._writerequirements()
-    finally:
-        destlock and destlock.release()
-        lock and lock.release()
-
-    # update store, spath, svfs and sjoin of repo
-    repo.unfiltered().__init__(repo.baseui, repo.root)
+    hg.unshare(ui, repo)
 
 # Wrap clone command to pass auto share options.
 def clone(orig, ui, source, *args, **opts):