equal
deleted
inserted
replaced
206 return templates |
206 return templates |
207 |
207 |
208 def _shrinktext(text, subfunc): |
208 def _shrinktext(text, subfunc): |
209 '''Helper for keyword expansion removal in text. |
209 '''Helper for keyword expansion removal in text. |
210 Depending on subfunc also returns number of substitutions.''' |
210 Depending on subfunc also returns number of substitutions.''' |
211 return subfunc(r'$\1$', text) |
211 return subfunc(br'$\1$', text) |
212 |
212 |
213 def _preselect(wstatus, changed): |
213 def _preselect(wstatus, changed): |
214 '''Retrieves modified and added files from a working directory state |
214 '''Retrieves modified and added files from a working directory state |
215 and returns the subset of each contained in given changed files |
215 and returns the subset of each contained in given changed files |
216 retrieved from a change context.''' |
216 retrieved from a change context.''' |
248 return '|'.join(map(stringutil.reescape, self.templates.keys())) |
248 return '|'.join(map(stringutil.reescape, self.templates.keys())) |
249 |
249 |
250 @util.propertycache |
250 @util.propertycache |
251 def rekw(self): |
251 def rekw(self): |
252 '''Returns regex for unexpanded keywords.''' |
252 '''Returns regex for unexpanded keywords.''' |
253 return re.compile(r'\$(%s)\$' % self.escape) |
253 return re.compile(br'\$(%s)\$' % self.escape) |
254 |
254 |
255 @util.propertycache |
255 @util.propertycache |
256 def rekwexp(self): |
256 def rekwexp(self): |
257 '''Returns regex for expanded keywords.''' |
257 '''Returns regex for expanded keywords.''' |
258 return re.compile(r'\$(%s): [^$\n\r]*? \$' % self.escape) |
258 return re.compile(br'\$(%s): [^$\n\r]*? \$' % self.escape) |
259 |
259 |
260 def substitute(self, data, path, ctx, subfunc): |
260 def substitute(self, data, path, ctx, subfunc): |
261 '''Replaces keywords in data with expanded template.''' |
261 '''Replaces keywords in data with expanded template.''' |
262 def kwsub(mobj): |
262 def kwsub(mobj): |
263 kw = mobj.group(1) |
263 kw = mobj.group(1) |