# HG changeset patch # User Christian Ebert # Date 1196511313 -3600 # Node ID 78b80b2511dec96abae744d559ce0ec1864e47f1 # Parent d3cdaa49a64443ac7d621be9ead0c0a5ccb14694 Rename kwtemplater.t to kwtemplater.ct diff -r d3cdaa49a644 -r 78b80b2511de hgkw/keyword.py --- a/hgkw/keyword.py Sat Dec 01 10:32:40 2007 +0100 +++ b/hgkw/keyword.py Sat Dec 01 13:15:13 2007 +0100 @@ -110,7 +110,7 @@ def __init__(self, ui, repo, expand, path='', node=None): self.ui = ui self.repo = repo - self.t = expand or None + self.ct = expand or None self.path = path self.node = node @@ -122,10 +122,10 @@ escaped = map(re.escape, self.templates.keys()) kwpat = r'\$(%s)(: [^$\n\r]*? )??\$' % '|'.join(escaped) self.re_kw = re.compile(kwpat) - if self.t: + if self.ct: templater.common_filters['utcdate'] = utcdate - self.t = cmdutil.changeset_templater(self.ui, self.repo, - False, '', False) + self.ct = cmdutil.changeset_templater(self.ui, self.repo, + False, '', False) def substitute(self, node, data, subfunc): '''Obtains node if missing, and calls given substitution function.''' @@ -136,10 +136,10 @@ def kwsub(mobj): '''Substitutes keyword using corresponding template.''' kw = mobj.group(1) - self.t.use_template(self.templates[kw]) + self.ct.use_template(self.templates[kw]) self.ui.pushbuffer() - self.t.show(changenode=self.node, - root=self.repo.root, file=self.path) + self.ct.show(changenode=self.node, + root=self.repo.root, file=self.path) return '$%s: %s $' % (kw, templater.firstline(self.ui.popbuffer())) return subfunc(kwsub, data) @@ -157,7 +157,7 @@ Keywords in data are expanded, if templater was initialized.''' if util.binary(data): return data, None - if self.t: + if self.ct: return self.substitute(node, data, self.re_kw.subn) return data, self.re_kw.search(data) @@ -171,7 +171,7 @@ '''Overwrites files in working directory if keywords are detected. Keywords are expanded if keyword templater is initialized, otherwise their substitution is removed.''' - expand = self.t is not None + expand = self.ct is not None action = ('shrinking', 'expanding')[expand] notify = (self.ui.note, self.ui.debug)[commit] for f in candidates: