xdiff: fix a hard crash on Windows
The xdiff case of test-diff-antipatience.t started crashing in the C extension
with
882657a9f768 (with
6a71a5ba666b backported so it compiles). There are a
few more instances of 'long', but this resolves the crashing.
templater: split template functions to new module
It has grown enough to be a dedicated module.
templater: move hybrid class and functions to templateutil module
And make _hybrid and _mappable classes public. _showlist() is still marked
as private since it's weird and third-party codes shouldn't depend on it.
templater: move stringify() to templateutil module
As we have a util module, it doesn't make sense to import stringify() from
templatefilters.py.
dagop: extract core algorithm of annotate() from context.py
See the previous patch for why.