Mercurial > public > mercurial-scm > hg-stable
diff mercurial/subrepo.py @ 24645:b39afa36006a
subrepo: precisely identify the missing subrepo spec file
It isn't obvious which file is the problem with deep subrepos, so provide the
path. Since the parsing is done with a ctx and not a subrepo object, it isn't
possible to display a path from the root subrepo. Therefore, the path shown is
relative to cwd.
There's no test coverage for the first abort, and I couldn't figure out how to
trigger it, but it is changed for consistency.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 05 Apr 2015 15:08:55 -0400 |
parents | 1ff35d76421c |
children | 98ab035e9332 |
line wrap: on
line diff
--- a/mercurial/subrepo.py Sun Apr 05 12:12:02 2015 -0700 +++ b/mercurial/subrepo.py Sun Apr 05 15:08:55 2015 -0400 @@ -70,11 +70,14 @@ if err.errno != errno.ENOENT: raise # handle missing subrepo spec files as removed - ui.warn(_("warning: subrepo spec file %s not found\n") % f) + ui.warn(_("warning: subrepo spec file \'%s\' not found\n") % + util.pathto(ctx.repo().root, ctx.repo().getcwd(), f)) return p.parse(f, data, sections, remap, read) else: - raise util.Abort(_("subrepo spec file %s not found") % f) + repo = ctx.repo() + raise util.Abort(_("subrepo spec file \'%s\' not found") % + util.pathto(repo.root, repo.getcwd(), f)) if '.hgsub' in ctx: read('.hgsub') @@ -92,9 +95,11 @@ try: revision, path = l.split(" ", 1) except ValueError: + repo = ctx.repo() raise util.Abort(_("invalid subrepository revision " - "specifier in .hgsubstate line %d") - % (i + 1)) + "specifier in \'%s\' line %d") + % (util.pathto(repo.root, repo.getcwd(), + '.hgsubstate'), (i + 1))) rev[path] = revision except IOError, err: if err.errno != errno.ENOENT: