##// END OF EJS Templates
share: move the implementation of 'unshare' to the 'hg' module...
Matt Harbison -
r34879:9f7ecc5b default
parent child Browse files
Show More
@@ -114,28 +114,7 b' def unshare(ui, repo):'
114 if not repo.shared():
114 if not repo.shared():
115 raise error.Abort(_("this is not a shared repo"))
115 raise error.Abort(_("this is not a shared repo"))
116
116
117 destlock = lock = None
117 hg.unshare(ui, repo)
118 lock = repo.lock()
119 try:
120 # we use locks here because if we race with commit, we
121 # can end up with extra data in the cloned revlogs that's
122 # not pointed to by changesets, thus causing verify to
123 # fail
124
125 destlock = hg.copystore(ui, repo, repo.path)
126
127 sharefile = repo.vfs.join('sharedpath')
128 util.rename(sharefile, sharefile + '.old')
129
130 repo.requirements.discard('shared')
131 repo.requirements.discard('relshared')
132 repo._writerequirements()
133 finally:
134 destlock and destlock.release()
135 lock and lock.release()
136
137 # update store, spath, svfs and sjoin of repo
138 repo.unfiltered().__init__(repo.baseui, repo.root)
139
118
140 # Wrap clone command to pass auto share options.
119 # Wrap clone command to pass auto share options.
141 def clone(orig, ui, source, *args, **opts):
120 def clone(orig, ui, source, *args, **opts):
@@ -257,6 +257,35 b' def share(ui, source, dest=None, update='
257 _postshareupdate(r, update, checkout=checkout)
257 _postshareupdate(r, update, checkout=checkout)
258 return r
258 return r
259
259
260 def unshare(ui, repo):
261 """convert a shared repository to a normal one
262
263 Copy the store data to the repo and remove the sharedpath data.
264 """
265
266 destlock = lock = None
267 lock = repo.lock()
268 try:
269 # we use locks here because if we race with commit, we
270 # can end up with extra data in the cloned revlogs that's
271 # not pointed to by changesets, thus causing verify to
272 # fail
273
274 destlock = copystore(ui, repo, repo.path)
275
276 sharefile = repo.vfs.join('sharedpath')
277 util.rename(sharefile, sharefile + '.old')
278
279 repo.requirements.discard('shared')
280 repo.requirements.discard('relshared')
281 repo._writerequirements()
282 finally:
283 destlock and destlock.release()
284 lock and lock.release()
285
286 # update store, spath, svfs and sjoin of repo
287 repo.unfiltered().__init__(repo.baseui, repo.root)
288
260 def postshare(sourcerepo, destrepo, bookmarks=True, defaultpath=None):
289 def postshare(sourcerepo, destrepo, bookmarks=True, defaultpath=None):
261 """Called after a new shared repo is created.
290 """Called after a new shared repo is created.
262
291
General Comments 0
You need to be logged in to leave comments. Login now