comparison mercurial/cmdutil.py @ 41625: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
comparison
equal deleted inserted replaced
41624:3751595ec45e 41625:93620a4ba88d
2359 2359
2360 for subpath in sorted(ctx.substate): 2360 for subpath in sorted(ctx.substate):
2361 sub = ctx.sub(subpath) 2361 sub = ctx.sub(subpath)
2362 try: 2362 try:
2363 submatch = matchmod.subdirmatcher(subpath, matcher) 2363 submatch = matchmod.subdirmatcher(subpath, matcher)
2364 2364 subprefix = os.path.join(prefix, sub._path)
2365 if not sub.cat(submatch, basefm, fntemplate, 2365 if not sub.cat(submatch, basefm, fntemplate, subprefix,
2366 os.path.join(prefix, sub._path),
2367 **pycompat.strkwargs(opts)): 2366 **pycompat.strkwargs(opts)):
2368 err = 0 2367 err = 0
2369 except error.RepoLookupError: 2368 except error.RepoLookupError:
2370 ui.status(_("skipping missing subrepository: %s\n") 2369 ui.status(_("skipping missing subrepository: %s\n") % subprefix)
2371 % os.path.join(prefix, subpath))
2372 2370
2373 return err 2371 return err
2374 2372
2375 def commit(ui, repo, commitfunc, pats, opts): 2373 def commit(ui, repo, commitfunc, pats, opts):
2376 '''commit the specified files or all outstanding changes''' 2374 '''commit the specified files or all outstanding changes'''