Show More
@@ -5,7 +5,7 b'' | |||
|
5 | 5 | # This software may be used and distributed according to the terms of the |
|
6 | 6 | # GNU General Public License version 2 or any later version. |
|
7 | 7 | |
|
8 | import parser, error, util, merge | |
|
8 | import parser, error, util, merge, re | |
|
9 | 9 | from i18n import _ |
|
10 | 10 | |
|
11 | 11 | elements = { |
@@ -235,12 +235,21 b' def hgignore(mctx, x):' | |||
|
235 | 235 | ignore = mctx.ctx._repo.dirstate._ignore |
|
236 | 236 | return [f for f in mctx.subset if ignore(f)] |
|
237 | 237 | |
|
238 | def grep(mctx, x): | |
|
239 | """``grep(regex)`` | |
|
240 | File contains the given regular expression. | |
|
241 | """ | |
|
242 | pat = getstring(x, _("grep requires a pattern")) | |
|
243 | r = re.compile(pat) | |
|
244 | return [f for f in mctx.subset if r.search(mctx.ctx[f].data())] | |
|
245 | ||
|
238 | 246 | symbols = { |
|
239 | 247 | 'added': added, |
|
240 | 248 | 'binary': binary, |
|
241 | 249 | 'clean': clean, |
|
242 | 250 | 'deleted': deleted, |
|
243 | 251 | 'exec': exec_, |
|
252 | 'grep': grep, | |
|
244 | 253 | 'ignored': ignored, |
|
245 | 254 | 'hgignore': hgignore, |
|
246 | 255 | 'modified': modified, |
General Comments 0
You need to be logged in to leave comments.
Login now