Show More
@@ -286,6 +286,13 b' def unshare(ui, repo):' | |||||
286 | # update store, spath, svfs and sjoin of repo |
|
286 | # update store, spath, svfs and sjoin of repo | |
287 | repo.unfiltered().__init__(repo.baseui, repo.root) |
|
287 | repo.unfiltered().__init__(repo.baseui, repo.root) | |
288 |
|
288 | |||
|
289 | # TODO: figure out how to access subrepos that exist, but were previously | |||
|
290 | # removed from .hgsub | |||
|
291 | c = repo['.'] | |||
|
292 | subs = c.substate | |||
|
293 | for s in sorted(subs): | |||
|
294 | c.sub(s).unshare() | |||
|
295 | ||||
289 | def postshare(sourcerepo, destrepo, bookmarks=True, defaultpath=None): |
|
296 | def postshare(sourcerepo, destrepo, bookmarks=True, defaultpath=None): | |
290 | """Called after a new shared repo is created. |
|
297 | """Called after a new shared repo is created. | |
291 |
|
298 |
@@ -621,6 +621,11 b' class abstractsubrepo(object):' | |||||
621 | def shortid(self, revid): |
|
621 | def shortid(self, revid): | |
622 | return revid |
|
622 | return revid | |
623 |
|
623 | |||
|
624 | def unshare(self): | |||
|
625 | ''' | |||
|
626 | convert this repository from shared to normal storage. | |||
|
627 | ''' | |||
|
628 | ||||
624 | def verify(self): |
|
629 | def verify(self): | |
625 | '''verify the integrity of the repository. Return 0 on success or |
|
630 | '''verify the integrity of the repository. Return 0 on success or | |
626 | warning, 1 on any error. |
|
631 | warning, 1 on any error. | |
@@ -1083,6 +1088,24 b' class hgsubrepo(abstractsubrepo):' | |||||
1083 | def shortid(self, revid): |
|
1088 | def shortid(self, revid): | |
1084 | return revid[:12] |
|
1089 | return revid[:12] | |
1085 |
|
1090 | |||
|
1091 | @annotatesubrepoerror | |||
|
1092 | def unshare(self): | |||
|
1093 | # subrepo inherently violates our import layering rules | |||
|
1094 | # because it wants to make repo objects from deep inside the stack | |||
|
1095 | # so we manually delay the circular imports to not break | |||
|
1096 | # scripts that don't use our demand-loading | |||
|
1097 | global hg | |||
|
1098 | from . import hg as h | |||
|
1099 | hg = h | |||
|
1100 | ||||
|
1101 | # Nothing prevents a user from sharing in a repo, and then making that a | |||
|
1102 | # subrepo. Alternately, the previous unshare attempt may have failed | |||
|
1103 | # part way through. So recurse whether or not this layer is shared. | |||
|
1104 | if self._repo.shared(): | |||
|
1105 | self.ui.status(_("unsharing subrepo '%s'\n") % self._relpath) | |||
|
1106 | ||||
|
1107 | hg.unshare(self.ui, self._repo) | |||
|
1108 | ||||
1086 | def verify(self): |
|
1109 | def verify(self): | |
1087 | try: |
|
1110 | try: | |
1088 | rev = self._state[1] |
|
1111 | rev = self._state[1] |
@@ -51,6 +51,24 b' hg subrepos are shared into existence on' | |||||
51 | $ hg -R clone1 update -C tip |
|
51 | $ hg -R clone1 update -C tip | |
52 | cloning subrepo subrepo from $TESTTMP/test/subrepo |
|
52 | cloning subrepo subrepo from $TESTTMP/test/subrepo | |
53 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
53 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
54 | $ find share2 | egrep 'sharedpath|00.+\.i' | sort | |||
|
55 | share2/.hg/sharedpath | |||
|
56 | share2/subrepo/.hg/sharedpath | |||
|
57 | $ hg -R share2 unshare | |||
|
58 | unsharing subrepo 'subrepo' | |||
|
59 | $ find share2 | egrep 'sharedpath|00.+\.i' | sort | |||
|
60 | share2/.hg/00changelog.i | |||
|
61 | share2/.hg/sharedpath.old | |||
|
62 | share2/.hg/store/00changelog.i | |||
|
63 | share2/.hg/store/00manifest.i | |||
|
64 | share2/subrepo/.hg/00changelog.i | |||
|
65 | share2/subrepo/.hg/sharedpath.old | |||
|
66 | share2/subrepo/.hg/store/00changelog.i | |||
|
67 | share2/subrepo/.hg/store/00manifest.i | |||
|
68 | $ hg -R share2/subrepo log -r tip -T compact | |||
|
69 | 1[tip] 559dcc9bfa65 1970-01-01 00:00 +0000 test | |||
|
70 | subrepo mod | |||
|
71 | ||||
54 | $ rm -rf clone1 |
|
72 | $ rm -rf clone1 | |
55 |
|
73 | |||
56 | $ hg clone -qr 1 test clone1 |
|
74 | $ hg clone -qr 1 test clone1 |
General Comments 0
You need to be logged in to leave comments.
Login now