subrepo: avoid calculating subrepo prefix twice for cat() (API)
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 07 Feb 2019 09:46:36 -0800
changeset 41625 93620a4ba88d
parent 41624 3751595ec45e
child 41626 2c549abc6b85
subrepo: avoid calculating subrepo prefix twice for cat() (API) Differential Revision: https://phab.mercurial-scm.org/D5881
mercurial/cmdutil.py
--- 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