Mercurial > public > mercurial-scm > hg
comparison mercurial/debugcommands.py @ 45309:65a812ed9e9f
templater: replace templatepath() with function that also opens the file
For frozen binaries, such as those created by PyOxidizer, I plan to
make it so the templatespec can keep an opened file/resource to read
from instead of needing a file path. Having `templatepath()` return an
opened file should help with that. At this point, it's just a wasteful
extra opening of mapfiles that we'll open again later. I'll update the
read-side next so it reads from the file-like object without opening
the file again.
Differential Revision: https://phab.mercurial-scm.org/D8892
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 04 Aug 2020 13:21:29 -0700 |
parents | d5ccc059fbcd |
children | 4aa484efc926 |
comparison
equal
deleted
inserted
replaced
45308:dc10bcd5c08d | 45309:65a812ed9e9f |
---|---|
1670 # templates | 1670 # templates |
1671 p = templater.templatedir() | 1671 p = templater.templatedir() |
1672 fm.write(b'templatedirs', b'checking templates (%s)...\n', p or b'') | 1672 fm.write(b'templatedirs', b'checking templates (%s)...\n', p or b'') |
1673 fm.condwrite(not p, b'', _(b" no template directories found\n")) | 1673 fm.condwrite(not p, b'', _(b" no template directories found\n")) |
1674 if p: | 1674 if p: |
1675 m = templater.templatepath(b"map-cmdline.default") | 1675 (m, fp) = templater.open_template(b"map-cmdline.default") |
1676 if m: | 1676 if m: |
1677 # template found, check if it is working | 1677 # template found, check if it is working |
1678 err = None | 1678 err = None |
1679 try: | 1679 try: |
1680 templater.templater.frommapfile(m) | 1680 templater.templater.frommapfile(m) |