Turn off debug while expanding
We don't need templates like file_add etc. as keywords a file specific.
Turning off debug avoids accidental expansion of such templates.
As a side effect it speeds up expansion when running hg --debug.
Functionality of _ctxnode now in new _substitute function.