--- a/hgkw/keyword.py Wed Nov 14 13:36:41 2007 +0100
+++ b/hgkw/keyword.py Mon Nov 26 12:52:54 2007 +0100
@@ -168,7 +168,6 @@
self.t = expand or None
self.path = path
self.node = node
- self.debug = self.ui.debugflag
kwmaps = self.ui.configitems('keywordmaps')
if kwmaps: # override default templates
@@ -210,26 +209,22 @@
except AttributeError:
self.repo.dirstate.update(files, 'n')
- def kwsub(self, mobj):
- '''Substitutes keyword using corresponding template.'''
- kw = mobj.group(1)
- self.t.use_template(self.templates[kw])
- self.ui.pushbuffer()
- self.t.show(changenode=self.node, root=self.repo.root, file=self.path)
- keywordsub = templater.firstline(self.ui.popbuffer())
- return '$%s: %s $' % (kw, keywordsub)
-
def substitute(self, node, data, subfunc):
- '''Obtains node if missing.
- Ensures consistent templates regardless of ui.debugflag.
- Calls given substitution function.'''
+ '''Obtains node if missing, and calls given substitution function.'''
if not self.node:
c = context.filectx(self.repo, self.path, fileid=node)
self.node = c.node()
- self.ui.debugflag = False
- result = subfunc(self.kwsub, data)
- self.ui.debugflag = self.debug
- return result
+
+ def kwsub(mobj):
+ '''Substitutes keyword using corresponding template.'''
+ kw = mobj.group(1)
+ self.t.use_template(self.templates[kw])
+ self.ui.pushbuffer()
+ self.t.show(changenode=self.node,
+ root=self.repo.root, file=self.path)
+ return '$%s: %s $' % (kw, templater.firstline(self.ui.popbuffer()))
+
+ return subfunc(kwsub, data)
def expand(self, node, data):
'''Returns data with keywords expanded.'''