templates: move filters to their own module stable
authorMatt Mackall <mpm@selenic.com>
Thu, 31 Jan 2008 14:44:19 -0600
branchstable
changeset 363 263b3b10c55f
parent 362 3ea0cbaf3535
child 371 c093df5fd251
templates: move filters to their own module This eliminates just about all Mercurial dependencies in templater.py [ original upstream description ]
hgkw/keyword.py
--- a/hgkw/keyword.py	Tue Jan 08 22:40:51 2008 -0500
+++ b/hgkw/keyword.py	Thu Jan 31 14:44:19 2008 -0600
@@ -80,8 +80,8 @@
 "Log = {desc}" expands to the first line of the changeset description.
 '''
 
-from mercurial import commands, cmdutil, context, dispatch, filelog
-from mercurial import patch, localrepo, revlog, templater, util
+from mercurial import commands, cmdutil, context, dispatch, filelog, revlog
+from mercurial import patch, localrepo, templater, templatefilters, util
 from mercurial.node import *
 from mercurial.i18n import _
 import re, shutil, sys, tempfile, time
@@ -132,7 +132,7 @@
         kwpat = r'\$(%s)(: [^$\n\r]*? )??\$' % '|'.join(escaped)
         self.re_kw = re.compile(kwpat)
 
-        templater.common_filters['utcdate'] = utcdate
+        templatefilters.filters['utcdate'] = utcdate
         self.ct = cmdutil.changeset_templater(self.ui, self.repo,
                                               False, '', False)
 
@@ -151,7 +151,8 @@
             self.ct.use_template(self.templates[kw])
             self.ui.pushbuffer()
             self.ct.show(changenode=fnode, root=self.repo.root, file=self.path)
-            return '$%s: %s $' % (kw, templater.firstline(self.ui.popbuffer()))
+            return '$%s: %s $' % (kw, templatefilters.firstline(
+                self.ui.popbuffer()))
 
         return subfunc(kwsub, data)