templater: raise error for unknown func

Previously, if a template '{foo()}' was given, the buildfunc would not be able
to match it and hit a code path that would not return so it would error out
later in the templater stating that NoneType was not iterable. This patch makes
sure that a proper error is raised so that the user can be informed.

Tests have been updated.

--HG--
branch : stable
extra : rebase_source : 881859a95f5df9b888ce4b774f3a099e4b675411
hg: introduce "wirepeersetupfuncs" to setup wire peer by extensions (issue4109)

Since changeset 6f72e7d28b35, "reposetup()" of each extensions is
invoked only on repositories enabling corresponded extensions.

This causes that largefiles specific interactions between the
repository enabling largefiles locally and remote (wire) peer fail,
because there is no way to know whether largefiles is enabled on the
remote repository behind the wire peer, and largefiles specific
"wireproto functions" are not given to any wire peers.

To avoid this problem, largefiles should be enabled in wider scope
than each repositories (e.g. user-wide "${HOME}/.hgrc").

This patch introduces "wirepeersetupfuncs" to setup wire peer by
extensions already enabled. Functions registered into
"wirepeersetupfuncs" are invoked for all wire peers.

This patch uses plain list instead of "util.hooks" for
"wirepeersetupfuncs", because the former allows to control order of
function invocation by order of extension enabling: it may be useful
for workaround of problems with combination of enabled extensions

--HG--
branch : stable
extra : rebase_source : bb8b72a285cbf89b1f66ecf9b1a3edff9c1bc4fa
tests: use TESTTMP instead of TESTDIR

In 57d0c8c3b947, f042d4b263f4, 1e686e55780c, and 5d22cadd1938, new tests were
added that used TESTDIR instead of TESTTMP thereby leading to polluting the
working directory with these temporary files. Now, we use TESTTMP so that they
will be cleaned up properly.

--HG--
branch : stable
extra : rebase_source : f321c707a8790bec0d88ed85de3c7ea144d1e2af