diff mercurial/grep.py @ 45698:41e0cbccb260

grep: move getbody() to grepsearcher class
author Yuya Nishihara <yuya@tcha.org>
date Wed, 09 Sep 2020 16:00:03 +0900
parents 494642ed3c50
children 888e633f0c1c
line wrap: on
line diff
--- a/mercurial/grep.py	Wed Sep 09 15:56:40 2020 +0900
+++ b/mercurial/grep.py	Wed Sep 09 16:00:03 2020 +0900
@@ -90,3 +90,13 @@
         self._copies = {}
         self._skip = set()
         self._revfiles = {}
+
+    def _grepbody(self, fn, rev, body):
+        self._matches[rev].setdefault(fn, [])
+        m = self._matches[rev][fn]
+        if body is None:
+            return
+
+        for lnum, cstart, cend, line in matchlines(body, self._regexp):
+            s = linestate(line, lnum, cstart, cend)
+            m.append(s)