Martin von Zweigbergk <martinvonz@google.com> [Thu, 06 Aug 2020 10:52:52 -0700] rev 45321
templater: restructure open_template() a little to prepare for relative paths
I found that it was easier to add support for relative paths after
this restructuring. It also made it easier to explain each case with a
code comment (which I did).
Differential Revision: https://phab.mercurial-scm.org/D8906
Martin von Zweigbergk <martinvonz@google.com> [Thu, 06 Aug 2020 09:50:10 -0700] rev 45320
templater: add exception-raising version of open_template()
I'm about to add another caller of `open_template()` (in the template
loader). That caller will want to get exceptions instead of `(None,
None)` if the template doesn't exist. This patch therefore changes
`open_template()` to raise exceptions and adds a new
`try_open_template()` that returns the `(None, None)` value.
Differential Revision: https://phab.mercurial-scm.org/D8905
Martin von Zweigbergk <martinvonz@google.com> [Wed, 05 Aug 2020 22:13:51 -0700] rev 45319
templater: replace Py3-only exception types by super-types available in Py2
As noted by @indygreg, `test-check-pyflakes.t` started failing on Py2
after my recent D8894, because that introduced catching of the
Py3-only types `ModuleNotFoundError` and `FileNotFoundError`. Let's
switch to less precise types that are also available in Py2.
Differential Revision: https://phab.mercurial-scm.org/D8902