Comments
Patch
@@ -40,6 +40,7 @@
from mercurial.i18n import _
from mercurial import cmdutil, commands, hg, util, extensions, bookmarks, error
from mercurial.hg import repository, parseurl
+from mercurial.localrepo import LOCALREPOFILES
import errno
cmdtable = {}
@@ -86,8 +87,6 @@
sharetype = repo.shared()
if not sharetype:
raise error.Abort(_("this is not a shared repo"))
- elif sharetype == 'all':
- raise error.Abort(_("unsharing a fully shared repo is not supported"))
destlock = lock = None
lock = repo.lock()
@@ -97,10 +96,28 @@
# not pointed to by changesets, thus causing verify to
# fail
- destlock = hg.copystore(ui, repo, repo.path)
+ dstpath = repo.path
+ if repo.fullshare:
+ # in fullshare repositories we cannot use repo.path because it is
+ # the same as repo.sharedpath
+ dstpath = repo.localpath
+ destlock = hg.copystore(ui, repo, dstpath)
- sharefile = repo.join('sharedpath')
- util.rename(sharefile, sharefile + '.old')
+ sharepathfile = repo.join('sharedpath')
+ util.rename(sharepathfile, sharepathfile + '.old')
+ if repo.vfs.exists('shared'):
+ sharedfile = repo.join('shared')
+ util.rename(sharedfile, sharedfile + '.old')
+
+ if sharetype == 'all':
+ # copy everything in the source repo into the target repo,
+ # except for the cache, the local repository files (i.e. the things
+ # that are not shared), the store (which was already copied earlier)
+ # and the locks
+ srcpath = repo.sharedpath
+ ignore = [repo.join(f)
+ for f in LOCALREPOFILES + ('cache', 'store', 'lock', 'wlock')]
+ util.copyfiles(srcpath, dstpath, overwrite=False, ignore=ignore)
repo.requirements.discard('sharedpath')
repo._writerequirements()
@@ -527,6 +527,154 @@
undo.desc
undo.dirstate
+unshare a full share
+
+ $ hg unshare
+
+after unsharing the repo should have all the files of a regular repository
+
+ $ ls .hg
+ 00changelog.i
+ bookmarks
+ bookmarks.current
+ branch
+ cache
+ dirstate
+ last-message.txt
+ requires
+ shared.old
+ sharedpath.old
+ store
+ undo.backup.bookmarks
+ undo.backup.dirstate
+ undo.bookmarks
+ undo.branch
+ undo.desc
+ undo.dirstate
+ $ hg verify
+ checking changesets
+ checking manifests
+ crosschecking files in changesets and manifests
+ checking files
+ 2 files, 8 changesets, 8 total revisions
+
+new commits on the unshared repository should not appear on the source repo
+
+ $ echo c > c
+ $ hg add c
+ $ hg branch newbranch
+ marked working directory as branch newbranch
+ $ hg commit -m "add c"
+ $ hg bookmark newbookmark
+ $ hg log -G
+ @ changeset: 8:91c4a0b340bd
+ | branch: newbranch
+ | bookmark: bm3
+ | bookmark: newbookmark
+ | tag: tip
+ | parent: 6:5ea6503932c4
+ | user: test
+ | date: Thu Jan 01 00:00:00 1970 +0000
+ | summary: add c
+ |
+ | o changeset: 7:e0fb5f85a10b
+ | | bookmark: bm1
+ | | parent: 3:b87954705719
+ | | user: test
+ | | date: Thu Jan 01 00:00:00 1970 +0000
+ | | summary: created in share source
+ | |
+ o | changeset: 6:5ea6503932c4
+ | | branch: createdinshare
+ | | parent: 4:62f4ded848e4
+ | | user: test
+ | | date: Thu Jan 01 00:00:00 1970 +0000
+ | | summary: created in full share
+ | |
+ +---o changeset: 5:92793bfc8cad
+ | | bookmark: bm4
+ | | bookmark: bm5
+ | | user: test
+ | | date: Thu Jan 01 00:00:00 1970 +0000
+ | | summary: foo in b
+ | |
+ o | changeset: 4:62f4ded848e4
+ | | parent: 2:c2e0ac586386
+ | | user: test
+ | | date: Thu Jan 01 00:00:00 1970 +0000
+ | | summary: testing shared bookmarks
+ | |
+ | o changeset: 3:b87954705719
+ |/ user: test
+ | date: Thu Jan 01 00:00:00 1970 +0000
+ | summary: testing shared bookmarks
+ |
+ o changeset: 2:c2e0ac586386
+ | user: test
+ | date: Thu Jan 01 00:00:00 1970 +0000
+ | summary: another file
+ |
+ o changeset: 1:8af4dc49db9e
+ | user: test
+ | date: Thu Jan 01 00:00:00 1970 +0000
+ | summary: change in shared clone
+ |
+ o changeset: 0:d3873e73d99e
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: init
+
+ $ hg --repository ../repo1 log -G
+ @ changeset: 7:e0fb5f85a10b
+ | bookmark: bm1
+ | tag: tip
+ | parent: 3:b87954705719
+ | user: test
+ | date: Thu Jan 01 00:00:00 1970 +0000
+ | summary: created in share source
+ |
+ | o changeset: 6:5ea6503932c4
+ | | branch: createdinshare
+ | | bookmark: bm3
+ | | parent: 4:62f4ded848e4
+ | | user: test
+ | | date: Thu Jan 01 00:00:00 1970 +0000
+ | | summary: created in full share
+ | |
+ | | o changeset: 5:92793bfc8cad
+ | |/ bookmark: bm4
+ | | bookmark: bm5
+ | | user: test
+ | | date: Thu Jan 01 00:00:00 1970 +0000
+ | | summary: foo in b
+ | |
+ | o changeset: 4:62f4ded848e4
+ | | parent: 2:c2e0ac586386
+ | | user: test
+ | | date: Thu Jan 01 00:00:00 1970 +0000
+ | | summary: testing shared bookmarks
+ | |
+ o | changeset: 3:b87954705719
+ |/ user: test
+ | date: Thu Jan 01 00:00:00 1970 +0000
+ | summary: testing shared bookmarks
+ |
+ o changeset: 2:c2e0ac586386
+ | user: test
+ | date: Thu Jan 01 00:00:00 1970 +0000
+ | summary: another file
+ |
+ o changeset: 1:8af4dc49db9e
+ | user: test
+ | date: Thu Jan 01 00:00:00 1970 +0000
+ | summary: change in shared clone
+ |
+ o changeset: 0:d3873e73d99e
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: init
+
+
Explicitly kill daemons to let the test exit on Windows
$ killdaemons.py