Show More
@@ -275,9 +275,9 b' class basectx(object):' | |||||
275 | except error.LookupError: |
|
275 | except error.LookupError: | |
276 | return '' |
|
276 | return '' | |
277 |
|
277 | |||
278 | def sub(self, path): |
|
278 | def sub(self, path, allowcreate=True): | |
279 | '''return a subrepo for the stored revision of path, never wdir()''' |
|
279 | '''return a subrepo for the stored revision of path, never wdir()''' | |
280 | return subrepo.subrepo(self, path) |
|
280 | return subrepo.subrepo(self, path, allowcreate=allowcreate) | |
281 |
|
281 | |||
282 | def nullsub(self, path, pctx): |
|
282 | def nullsub(self, path, pctx): | |
283 | return subrepo.nullsubrepo(self, path, pctx) |
|
283 | return subrepo.nullsubrepo(self, path, pctx) |
@@ -886,7 +886,11 b' def verify(repo):' | |||||
886 | ctx = repo[rev] |
|
886 | ctx = repo[rev] | |
887 | try: |
|
887 | try: | |
888 | for subpath in ctx.substate: |
|
888 | for subpath in ctx.substate: | |
889 | ret = ctx.sub(subpath).verify() or ret |
|
889 | try: | |
|
890 | ret = (ctx.sub(subpath, allowcreate=False).verify() | |||
|
891 | or ret) | |||
|
892 | except error.RepoError as e: | |||
|
893 | repo.ui.warn(_('%s: %s\n') % (rev, e)) | |||
890 | except Exception: |
|
894 | except Exception: | |
891 | repo.ui.warn(_('.hgsubstate is corrupt in revision %s\n') % |
|
895 | repo.ui.warn(_('.hgsubstate is corrupt in revision %s\n') % | |
892 | node.short(ctx.node())) |
|
896 | node.short(ctx.node())) |
@@ -340,7 +340,7 b' def _sanitize(ui, vfs, ignore):' | |||||
340 | "in '%s'\n") % vfs.join(dirname)) |
|
340 | "in '%s'\n") % vfs.join(dirname)) | |
341 | vfs.unlink(vfs.reljoin(dirname, f)) |
|
341 | vfs.unlink(vfs.reljoin(dirname, f)) | |
342 |
|
342 | |||
343 | def subrepo(ctx, path, allowwdir=False): |
|
343 | def subrepo(ctx, path, allowwdir=False, allowcreate=True): | |
344 | """return instance of the right subrepo class for subrepo in path""" |
|
344 | """return instance of the right subrepo class for subrepo in path""" | |
345 | # subrepo inherently violates our import layering rules |
|
345 | # subrepo inherently violates our import layering rules | |
346 | # because it wants to make repo objects from deep inside the stack |
|
346 | # because it wants to make repo objects from deep inside the stack | |
@@ -356,7 +356,7 b' def subrepo(ctx, path, allowwdir=False):' | |||||
356 | raise error.Abort(_('unknown subrepo type %s') % state[2]) |
|
356 | raise error.Abort(_('unknown subrepo type %s') % state[2]) | |
357 | if allowwdir: |
|
357 | if allowwdir: | |
358 | state = (state[0], ctx.subrev(path), state[2]) |
|
358 | state = (state[0], ctx.subrev(path), state[2]) | |
359 | return types[state[2]](ctx, path, state[:2]) |
|
359 | return types[state[2]](ctx, path, state[:2], allowcreate) | |
360 |
|
360 | |||
361 | def nullsubrepo(ctx, path, pctx): |
|
361 | def nullsubrepo(ctx, path, pctx): | |
362 | """return an empty subrepo in pctx for the extant subrepo in ctx""" |
|
362 | """return an empty subrepo in pctx for the extant subrepo in ctx""" | |
@@ -375,7 +375,7 b' def nullsubrepo(ctx, path, pctx):' | |||||
375 | subrev = '' |
|
375 | subrev = '' | |
376 | if state[2] == 'hg': |
|
376 | if state[2] == 'hg': | |
377 | subrev = "0" * 40 |
|
377 | subrev = "0" * 40 | |
378 | return types[state[2]](pctx, path, (state[0], subrev)) |
|
378 | return types[state[2]](pctx, path, (state[0], subrev), True) | |
379 |
|
379 | |||
380 | def newcommitphase(ui, ctx): |
|
380 | def newcommitphase(ui, ctx): | |
381 | commitphase = phases.newcommitphase(ui) |
|
381 | commitphase = phases.newcommitphase(ui) | |
@@ -611,12 +611,12 b' class abstractsubrepo(object):' | |||||
611 | return self.wvfs.reljoin(reporelpath(self._ctx.repo()), self._path) |
|
611 | return self.wvfs.reljoin(reporelpath(self._ctx.repo()), self._path) | |
612 |
|
612 | |||
613 | class hgsubrepo(abstractsubrepo): |
|
613 | class hgsubrepo(abstractsubrepo): | |
614 | def __init__(self, ctx, path, state): |
|
614 | def __init__(self, ctx, path, state, allowcreate): | |
615 | super(hgsubrepo, self).__init__(ctx, path) |
|
615 | super(hgsubrepo, self).__init__(ctx, path) | |
616 | self._state = state |
|
616 | self._state = state | |
617 | r = ctx.repo() |
|
617 | r = ctx.repo() | |
618 | root = r.wjoin(path) |
|
618 | root = r.wjoin(path) | |
619 | create = not r.wvfs.exists('%s/.hg' % path) |
|
619 | create = allowcreate and not r.wvfs.exists('%s/.hg' % path) | |
620 | self._repo = hg.repository(r.baseui, root, create=create) |
|
620 | self._repo = hg.repository(r.baseui, root, create=create) | |
621 |
|
621 | |||
622 | # Propagate the parent's --hidden option |
|
622 | # Propagate the parent's --hidden option | |
@@ -1064,7 +1064,7 b' class hgsubrepo(abstractsubrepo):' | |||||
1064 | return reporelpath(self._repo) |
|
1064 | return reporelpath(self._repo) | |
1065 |
|
1065 | |||
1066 | class svnsubrepo(abstractsubrepo): |
|
1066 | class svnsubrepo(abstractsubrepo): | |
1067 | def __init__(self, ctx, path, state): |
|
1067 | def __init__(self, ctx, path, state, allowcreate): | |
1068 | super(svnsubrepo, self).__init__(ctx, path) |
|
1068 | super(svnsubrepo, self).__init__(ctx, path) | |
1069 | self._state = state |
|
1069 | self._state = state | |
1070 | self._exe = util.findexe('svn') |
|
1070 | self._exe = util.findexe('svn') | |
@@ -1284,7 +1284,7 b' class svnsubrepo(abstractsubrepo):' | |||||
1284 |
|
1284 | |||
1285 |
|
1285 | |||
1286 | class gitsubrepo(abstractsubrepo): |
|
1286 | class gitsubrepo(abstractsubrepo): | |
1287 | def __init__(self, ctx, path, state): |
|
1287 | def __init__(self, ctx, path, state, allowcreate): | |
1288 | super(gitsubrepo, self).__init__(ctx, path) |
|
1288 | super(gitsubrepo, self).__init__(ctx, path) | |
1289 | self._state = state |
|
1289 | self._state = state | |
1290 | self._abspath = ctx.repo().wjoin(path) |
|
1290 | self._abspath = ctx.repo().wjoin(path) |
@@ -121,4 +121,22 b' verify will warn if locked-in subrepo re' | |||||
121 | subrepo 'subrepo' is hidden in revision 674d05939c1e |
|
121 | subrepo 'subrepo' is hidden in revision 674d05939c1e | |
122 | subrepo 'subrepo' not found in revision a7d05d9055a4 |
|
122 | subrepo 'subrepo' not found in revision a7d05d9055a4 | |
123 |
|
123 | |||
|
124 | verifying shouldn't init a new subrepo if the reference doesn't exist | |||
|
125 | ||||
|
126 | $ mv subrepo b | |||
|
127 | $ hg verify | |||
|
128 | checking changesets | |||
|
129 | checking manifests | |||
|
130 | crosschecking files in changesets and manifests | |||
|
131 | checking files | |||
|
132 | 2 files, 5 changesets, 5 total revisions | |||
|
133 | checking subrepo links | |||
|
134 | 0: repository $TESTTMP/repo/subrepo not found (glob) | |||
|
135 | 1: repository $TESTTMP/repo/subrepo not found (glob) | |||
|
136 | 3: repository $TESTTMP/repo/subrepo not found (glob) | |||
|
137 | 4: repository $TESTTMP/repo/subrepo not found (glob) | |||
|
138 | $ ls | |||
|
139 | b | |||
|
140 | $ mv b subrepo | |||
|
141 | ||||
124 | $ cd .. |
|
142 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now