125 if templates: |
125 if templates: |
126 for k in templates.keys(): |
126 for k in templates.keys(): |
127 templates[k] = templater.parsestring(templates[k], |
127 templates[k] = templater.parsestring(templates[k], |
128 quoted=False) |
128 quoted=False) |
129 self.templates = templates or self.deftemplates |
129 self.templates = templates or self.deftemplates |
130 escaped = [re.escape(k) for k in self.templates.keys()] |
|
131 rawkeyword = r'\$(%s)[^$\n\r]*?\$' |
|
132 self.re_kw = re.compile(rawkeyword % '|'.join(escaped)) |
|
133 if self.t: |
130 if self.t: |
134 templater.common_filters['utcdate'] = utcdate |
131 templater.common_filters['utcdate'] = utcdate |
135 try: |
132 try: |
136 self.t = cmdutil.changeset_templater(self.ui, self.repo, |
133 self.t = cmdutil.changeset_templater(self.ui, self.repo, |
137 False, '', False) |
134 False, '', False) |
138 except TypeError: |
135 except TypeError: |
139 # depending on hg rev changeset_templater has extra "brinfo" arg |
136 # depending on hg rev changeset_templater has extra "brinfo" arg |
140 self.t = cmdutil.changeset_templater(self.ui, self.repo, |
137 self.t = cmdutil.changeset_templater(self.ui, self.repo, |
141 False, None, '', False) |
138 False, None, '', False) |
|
139 escaped = [re.escape(k) for k in self.templates.keys()] |
|
140 rawkeyword = r'\$(%s)(: [^$\n\r]*? )??\$' |
|
141 self.re_kw = re.compile(rawkeyword % '|'.join(escaped)) |
142 |
142 |
143 def _ctxnode(self, node): |
143 def _ctxnode(self, node): |
144 '''Obtains missing node from file context.''' |
144 '''Obtains missing node from file context.''' |
145 if not self.node: |
145 if not self.node: |
146 c = context.filectx(self.repo, self.path, fileid=node) |
146 c = context.filectx(self.repo, self.path, fileid=node) |