Mercurial > public > mercurial-scm > hg
comparison mercurial/grep.py @ 45719:c10c87c8fe79
grep: extract public function to register file to be skipped
The main grep loop will be extracted to a searcher method, but this skipping
condition depends on the result of display() function.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 09 Sep 2020 17:04:44 +0900 |
parents | c694b1841a5e |
children | f9d3ff23bfc0 |
comparison
equal
deleted
inserted
replaced
45718:87c35b5a14eb | 45719:c10c87c8fe79 |
---|---|
105 self._matches = {} | 105 self._matches = {} |
106 self._copies = {} | 106 self._copies = {} |
107 self._skip = set() | 107 self._skip = set() |
108 self._revfiles = {} | 108 self._revfiles = {} |
109 | 109 |
110 def skipfile(self, fn, rev): | |
111 """Exclude the given file (and the copy at the specified revision) | |
112 from future search""" | |
113 copy = self._copies.get(rev, {}).get(fn) | |
114 self._skip.add(fn) | |
115 if copy: | |
116 self._skip.add(copy) | |
117 | |
110 def _grepbody(self, fn, rev, body): | 118 def _grepbody(self, fn, rev, body): |
111 self._matches[rev].setdefault(fn, []) | 119 self._matches[rev].setdefault(fn, []) |
112 m = self._matches[rev][fn] | 120 m = self._matches[rev][fn] |
113 if body is None: | 121 if body is None: |
114 return | 122 return |