Show More
@@ -3400,7 +3400,7 b' def grep(ui, repo, pattern, *pats, **opt' | |||
|
3400 | 3400 | |
|
3401 | 3401 | getfile = util.lrucachefunc(repo.file) |
|
3402 | 3402 | |
|
3403 | def matchlines(body): | |
|
3403 | def matchlines(body, regexp): | |
|
3404 | 3404 | begin = 0 |
|
3405 | 3405 | linenum = 0 |
|
3406 | 3406 | while begin < len(body): |
@@ -3427,7 +3427,7 b' def grep(ui, repo, pattern, *pats, **opt' | |||
|
3427 | 3427 | def __eq__(self, other): |
|
3428 | 3428 | return self.line == other.line |
|
3429 | 3429 | |
|
3430 | def findpos(self): | |
|
3430 | def findpos(self, regexp): | |
|
3431 | 3431 | """Iterate all (start, end) indices of matches""" |
|
3432 | 3432 | yield self.colstart, self.colend |
|
3433 | 3433 | p = self.colend |
@@ -3450,7 +3450,7 b' def grep(ui, repo, pattern, *pats, **opt' | |||
|
3450 | 3450 | if body is None: |
|
3451 | 3451 | return |
|
3452 | 3452 | |
|
3453 | for lnum, cstart, cend, line in matchlines(body): | |
|
3453 | for lnum, cstart, cend, line in matchlines(body, regexp): | |
|
3454 | 3454 | s = linestate(line, lnum, cstart, cend) |
|
3455 | 3455 | m.append(s) |
|
3456 | 3456 | |
@@ -3562,7 +3562,7 b' def grep(ui, repo, pattern, *pats, **opt' | |||
|
3562 | 3562 | |
|
3563 | 3563 | def displaymatches(fm, l): |
|
3564 | 3564 | p = 0 |
|
3565 | for s, e in l.findpos(): | |
|
3565 | for s, e in l.findpos(regexp): | |
|
3566 | 3566 | if p < s: |
|
3567 | 3567 | fm.startitem() |
|
3568 | 3568 | fm.write(b'text', b'%s', l.line[p:s]) |
General Comments 0
You need to be logged in to leave comments.
Login now