##// END OF EJS Templates
subrepo: prefetch ctx.repo() for efficiency and centralization...
FUJIWARA Katsunori -
r25768:7a9ef860 default
parent child Browse files
Show More
@@ -62,6 +62,7 b' def state(ctx, ui):'
62 (key in types dict))
62 (key in types dict))
63 """
63 """
64 p = config.config()
64 p = config.config()
65 repo = ctx.repo()
65 def read(f, sections=None, remap=None):
66 def read(f, sections=None, remap=None):
66 if f in ctx:
67 if f in ctx:
67 try:
68 try:
@@ -71,11 +72,10 b' def state(ctx, ui):'
71 raise
72 raise
72 # handle missing subrepo spec files as removed
73 # handle missing subrepo spec files as removed
73 ui.warn(_("warning: subrepo spec file \'%s\' not found\n") %
74 ui.warn(_("warning: subrepo spec file \'%s\' not found\n") %
74 util.pathto(ctx.repo().root, ctx.repo().getcwd(), f))
75 util.pathto(repo.root, repo.getcwd(), f))
75 return
76 return
76 p.parse(f, data, sections, remap, read)
77 p.parse(f, data, sections, remap, read)
77 else:
78 else:
78 repo = ctx.repo()
79 raise util.Abort(_("subrepo spec file \'%s\' not found") %
79 raise util.Abort(_("subrepo spec file \'%s\' not found") %
80 util.pathto(repo.root, repo.getcwd(), f))
80 util.pathto(repo.root, repo.getcwd(), f))
81
81
@@ -95,7 +95,6 b' def state(ctx, ui):'
95 try:
95 try:
96 revision, path = l.split(" ", 1)
96 revision, path = l.split(" ", 1)
97 except ValueError:
97 except ValueError:
98 repo = ctx.repo()
99 raise util.Abort(_("invalid subrepository revision "
98 raise util.Abort(_("invalid subrepository revision "
100 "specifier in \'%s\' line %d")
99 "specifier in \'%s\' line %d")
101 % (util.pathto(repo.root, repo.getcwd(),
100 % (util.pathto(repo.root, repo.getcwd(),
@@ -132,7 +131,7 b' def state(ctx, ui):'
132 src = src.lstrip() # strip any extra whitespace after ']'
131 src = src.lstrip() # strip any extra whitespace after ']'
133
132
134 if not util.url(src).isabs():
133 if not util.url(src).isabs():
135 parent = _abssource(ctx.repo(), abort=False)
134 parent = _abssource(repo, abort=False)
136 if parent:
135 if parent:
137 parent = util.url(parent)
136 parent = util.url(parent)
138 parent.path = posixpath.join(parent.path or '', src)
137 parent.path = posixpath.join(parent.path or '', src)
General Comments 0
You need to be logged in to leave comments. Login now