Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/subrepo.py @ 16756:2e3513e7348a
subrepo: make subrepo.subrepo(<not a subrepo path>) fail
Until now, when calling subrepo.subrepo with a path at which there is no
subrepo, a "nullstate" tuple would be returned. However, this is not very
useful (the tuple can't really be used for creating a subrepo), so we'd just as
soon have the function just fail, and leave it up to the caller to decide what
to do.
The motivation for doing this now is to simplify the solution for (issue3056).
author | Dov Feldstern <dfeldstern@gmail.com> |
---|---|
date | Sun, 20 May 2012 21:11:34 +0300 |
parents | 525fdb738975 |
children | 6c05eebd9fab |
comparison
equal
deleted
inserted
replaced
16755:d0b9ebba41e9 | 16756:2e3513e7348a |
---|---|
266 global hg | 266 global hg |
267 import hg as h | 267 import hg as h |
268 hg = h | 268 hg = h |
269 | 269 |
270 scmutil.pathauditor(ctx._repo.root)(path) | 270 scmutil.pathauditor(ctx._repo.root)(path) |
271 state = ctx.substate.get(path, nullstate) | 271 state = ctx.substate[path] |
272 if state[2] not in types: | 272 if state[2] not in types: |
273 raise util.Abort(_('unknown subrepo type %s') % state[2]) | 273 raise util.Abort(_('unknown subrepo type %s') % state[2]) |
274 return types[state[2]](ctx, path, state[:2]) | 274 return types[state[2]](ctx, path, state[:2]) |
275 | 275 |
276 # subrepo classes need to implement the following abstract class: | 276 # subrepo classes need to implement the following abstract class: |