equal
deleted
inserted
replaced
7 |
7 |
8 from __future__ import absolute_import |
8 from __future__ import absolute_import |
9 |
9 |
10 import difflib |
10 import difflib |
11 |
11 |
12 from . import pycompat |
12 from . import ( |
|
13 pycompat, |
|
14 scmutil, |
|
15 util, |
|
16 ) |
13 |
17 |
14 |
18 |
15 def matchlines(body, regexp): |
19 def matchlines(body, regexp): |
16 begin = 0 |
20 begin = 0 |
17 linenum = 0 |
21 linenum = 0 |
67 elif tag == 'replace': |
71 elif tag == 'replace': |
68 for i in pycompat.xrange(alo, ahi): |
72 for i in pycompat.xrange(alo, ahi): |
69 yield (b'-', a[i]) |
73 yield (b'-', a[i]) |
70 for i in pycompat.xrange(blo, bhi): |
74 for i in pycompat.xrange(blo, bhi): |
71 yield (b'+', b[i]) |
75 yield (b'+', b[i]) |
|
76 |
|
77 |
|
78 class grepsearcher(object): |
|
79 """Search files and revisions for lines matching the given pattern""" |
|
80 |
|
81 def __init__(self, ui, repo, regexp): |
|
82 self._ui = ui |
|
83 self._repo = repo |
|
84 self._regexp = regexp |
|
85 |
|
86 self._getfile = util.lrucachefunc(repo.file) |
|
87 self._getrenamed = scmutil.getrenamedfn(repo) |
|
88 |
|
89 self._matches = {} |
|
90 self._copies = {} |
|
91 self._skip = set() |
|
92 self._revfiles = {} |