diff mercurial/cmdutil.py @ 41636:93620a4ba88d

subrepo: avoid calculating subrepo prefix twice for cat() (API) Differential Revision: https://phab.mercurial-scm.org/D5881
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 07 Feb 2019 09:46:36 -0800
parents 7068c6b0114b
children 2c549abc6b85
line wrap: on
line diff
--- 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