112 self.t.use_template(template) |
112 self.t.use_template(template) |
113 self.ui.pushbuffer() |
113 self.ui.pushbuffer() |
114 self.t.show(changenode=node, root=self.repo.root, file=path) |
114 self.t.show(changenode=node, root=self.repo.root, file=path) |
115 kwsub = templater.firstline(self.ui.popbuffer()) |
115 kwsub = templater.firstline(self.ui.popbuffer()) |
116 return '$%s: %s $' % (kw, kwsub) |
116 return '$%s: %s $' % (kw, kwsub) |
|
117 |
|
118 def shrink(self, text): |
|
119 '''Returns text with all keyword substitutions removed.''' |
|
120 return self.re_kw.sub(r'$\1$', text) |
117 |
121 |
118 |
122 |
119 def reposetup(ui, repo): |
123 def reposetup(ui, repo): |
120 '''Sets up repo, and filelog especially, as kwrepo and kwfilelog |
124 '''Sets up repo, and filelog especially, as kwrepo and kwfilelog |
121 for keyword substitution. This is done for local repos only.''' |
125 for keyword substitution. This is done for local repos only.''' |
204 return data |
208 return data |
205 |
209 |
206 def add(self, text, meta, tr, link, p1=None, p2=None): |
210 def add(self, text, meta, tr, link, p1=None, p2=None): |
207 '''Removes keyword substitutions when adding to filelog.''' |
211 '''Removes keyword substitutions when adding to filelog.''' |
208 if self.iskwcandidate(text): |
212 if self.iskwcandidate(text): |
209 text = self.kwt.re_kw.sub(r'$\1$', text) |
213 text = self.kwt.shrink(text) |
210 return super(kwfilelog, self).add(text, |
214 return super(kwfilelog, self).add(text, |
211 meta, tr, link, p1=p1, p2=p2) |
215 meta, tr, link, p1=p1, p2=p2) |
212 |
216 |
213 def cmp(self, node, text): |
217 def cmp(self, node, text): |
214 '''Removes keyword substitutions for comparison.''' |
218 '''Removes keyword substitutions for comparison.''' |
215 if self.iskwcandidate(text): |
219 if self.iskwcandidate(text): |
216 text = self.kwt.re_kw.sub(r'$\1$', text) |
220 text = self.kwt.shrink(text) |
217 return super(kwfilelog, self).cmp(node, text) |
221 return super(kwfilelog, self).cmp(node, text) |
218 |
222 |
219 filelog.filelog = kwfilelog |
223 filelog.filelog = kwfilelog |
220 repo.__class__ = kwrepo |
224 repo.__class__ = kwrepo |