subrepo: avoid calculating subrepo prefix twice for cat() (API)
Differential Revision: https://phab.mercurial-scm.org/D5881
--- a/mercurial/cmdutil.py Thu Feb 07 16:43:42 2019 +0300
+++ b/mercurial/cmdutil.py Thu Feb 07 09:46:36 2019 -0800
@@ -2361,14 +2361,12 @@
sub = ctx.sub(subpath)
try:
submatch = matchmod.subdirmatcher(subpath, matcher)
-
- if not sub.cat(submatch, basefm, fntemplate,
- os.path.join(prefix, sub._path),
+ subprefix = os.path.join(prefix, sub._path)
+ if not sub.cat(submatch, basefm, fntemplate, subprefix,
**pycompat.strkwargs(opts)):
err = 0
except error.RepoLookupError:
- ui.status(_("skipping missing subrepository: %s\n")
- % os.path.join(prefix, subpath))
+ ui.status(_("skipping missing subrepository: %s\n") % subprefix)
return err