comparison 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
comparison
equal deleted inserted replaced
24644:51930a7180bd 24645:b39afa36006a
68 data = ctx[f].data() 68 data = ctx[f].data()
69 except IOError, err: 69 except IOError, err:
70 if err.errno != errno.ENOENT: 70 if err.errno != errno.ENOENT:
71 raise 71 raise
72 # handle missing subrepo spec files as removed 72 # handle missing subrepo spec files as removed
73 ui.warn(_("warning: subrepo spec file %s not found\n") % f) 73 ui.warn(_("warning: subrepo spec file \'%s\' not found\n") %
74 util.pathto(ctx.repo().root, ctx.repo().getcwd(), f))
74 return 75 return
75 p.parse(f, data, sections, remap, read) 76 p.parse(f, data, sections, remap, read)
76 else: 77 else:
77 raise util.Abort(_("subrepo spec file %s not found") % f) 78 repo = ctx.repo()
79 raise util.Abort(_("subrepo spec file \'%s\' not found") %
80 util.pathto(repo.root, repo.getcwd(), f))
78 81
79 if '.hgsub' in ctx: 82 if '.hgsub' in ctx:
80 read('.hgsub') 83 read('.hgsub')
81 84
82 for path, src in ui.configitems('subpaths'): 85 for path, src in ui.configitems('subpaths'):
90 if not l: 93 if not l:
91 continue 94 continue
92 try: 95 try:
93 revision, path = l.split(" ", 1) 96 revision, path = l.split(" ", 1)
94 except ValueError: 97 except ValueError:
98 repo = ctx.repo()
95 raise util.Abort(_("invalid subrepository revision " 99 raise util.Abort(_("invalid subrepository revision "
96 "specifier in .hgsubstate line %d") 100 "specifier in \'%s\' line %d")
97 % (i + 1)) 101 % (util.pathto(repo.root, repo.getcwd(),
102 '.hgsubstate'), (i + 1)))
98 rev[path] = revision 103 rev[path] = revision
99 except IOError, err: 104 except IOError, err:
100 if err.errno != errno.ENOENT: 105 if err.errno != errno.ENOENT:
101 raise 106 raise
102 107