94 self.re_kw = re.compile(r'\$(%s)[^$]*?\$' % |
94 self.re_kw = re.compile(r'\$(%s)[^$]*?\$' % |
95 '|'.join(re.escape(k) for k in self.templates.keys())) |
95 '|'.join(re.escape(k) for k in self.templates.keys())) |
96 self.t = cmdutil.changeset_templater(self.ui, self.repo, |
96 self.t = cmdutil.changeset_templater(self.ui, self.repo, |
97 False, '', False) |
97 False, '', False) |
98 |
98 |
99 def expand(self, mobj, path): |
99 def expand(self, mobj, path, node=None): |
|
100 self.node = self.node or node |
100 kw = mobj.group(1) |
101 kw = mobj.group(1) |
101 template = templater.parsestring(self.templates[kw], quoted=False) |
102 template = templater.parsestring(self.templates[kw], quoted=False) |
102 self.t.use_template(template) |
103 self.t.use_template(template) |
103 self.ui.pushbuffer() |
104 self.ui.pushbuffer() |
104 self.t.show(changenode=self.node, |
105 self.t.show(changenode=self.node, |
139 '''Substitutes keywords when reading filelog.''' |
140 '''Substitutes keywords when reading filelog.''' |
140 data = super(kwfilelog, self).read(node) |
141 data = super(kwfilelog, self).read(node) |
141 if self.iskwcandidate(data): |
142 if self.iskwcandidate(data): |
142 c = context.filectx(self._repo, self._path, |
143 c = context.filectx(self._repo, self._path, |
143 fileid=node, filelog=self) |
144 fileid=node, filelog=self) |
144 self.kwt.node = c.node() |
|
145 return self.kwt.re_kw.sub(lambda m: |
145 return self.kwt.re_kw.sub(lambda m: |
146 self.kwt.expand(m, self._path), data) |
146 self.kwt.expand(m, self._path, node=c.node()), data) |
147 return data |
147 return data |
148 |
148 |
149 def add(self, text, meta, tr, link, p1=None, p2=None): |
149 def add(self, text, meta, tr, link, p1=None, p2=None): |
150 '''Removes keyword substitutions when adding to filelog.''' |
150 '''Removes keyword substitutions when adding to filelog.''' |
151 if self.iskwcandidate(text): |
151 if self.iskwcandidate(text): |