[PATCH 2 of 2] cat: do not instantiate subrepo if no potential match in it
yuya at tcha.org
Mon Nov 27 07:35:04 EST 2017
On Sun, 26 Nov 2017 20:11:25 -0500, Matt Harbison wrote:
> On Sun, 26 Nov 2017 05:38:53 -0500, Yuya Nishihara <yuya at tcha.org> wrote:
> > On Sat, 25 Nov 2017 23:53:45 -0500, Matt Harbison wrote:
> >> It's probably beyond the scope of what you were fixing, but should all
> >> subrepo recursion be guarded like this?
> >> > sub = ctx.sub(subpath)
> >> > try:
> >> > submatch = matchmod.subdirmatcher(subpath, matcher)
> > Maybe we'll need ctx.walksub(matcher) which yields (subrepo, submatcher)
> > pairs?
> I like it.
> I wonder if the exception handler that prints 'skipping..' can be rolled
> in too.
I think that's up to a caller whether a missing subrepo can be ignored or not.
> At least cmdutil.add() and cmdutil.cat() catch different things,
> and I have a vague recollection that there was also some uncaught
> exception in this area. (I don't recall what it was, maybe the subrepo
> being completely missing?)
Perhaps catching error.LookupError is wrong. It's the exception raised when
ambiguous identifier is passed to repo.
More information about the Mercurial-devel