Show More
@@ -41,6 +41,7 b' sys.path.append(project_path)' | |||
|
41 | 41 | |
|
42 | 42 | from rhodecode.config.conf import INDEX_EXTENSIONS |
|
43 | 43 | from rhodecode.model.scm import ScmModel |
|
44 | from rhodecode.model.db import Repository | |
|
44 | 45 | from rhodecode.lib.utils2 import safe_unicode, safe_str |
|
45 | 46 | from rhodecode.lib.indexers import SCHEMA, IDX_NAME, CHGSETS_SCHEMA, \ |
|
46 | 47 | CHGSET_IDX_NAME |
@@ -109,6 +110,18 b' class WhooshIndexingDaemon(object):' | |||
|
109 | 110 | else: |
|
110 | 111 | self.initial = False |
|
111 | 112 | |
|
113 | def _get_index_revision(self, repo): | |
|
114 | db_repo = Repository.get_by_repo_name(repo.name) | |
|
115 | landing_rev = 'tip' | |
|
116 | if db_repo: | |
|
117 | landing_rev = db_repo.landing_rev | |
|
118 | return landing_rev | |
|
119 | ||
|
120 | def _get_index_changeset(self, repo): | |
|
121 | index_rev = self._get_index_revision(repo) | |
|
122 | cs = repo.get_changeset(index_rev) | |
|
123 | return cs | |
|
124 | ||
|
112 | 125 | def get_paths(self, repo): |
|
113 | 126 | """ |
|
114 | 127 | recursive walk in root dir and return a set of all path in that dir |
@@ -116,8 +129,8 b' class WhooshIndexingDaemon(object):' | |||
|
116 | 129 | """ |
|
117 | 130 | index_paths_ = set() |
|
118 | 131 | try: |
|
119 |
|
|
|
120 |
for _topnode, _dirs, files in |
|
|
132 | cs = self._get_index_changeset(repo) | |
|
133 | for _topnode, _dirs, files in cs.walk('/'): | |
|
121 | 134 | for f in files: |
|
122 | 135 | index_paths_.add(jn(safe_str(repo.path), safe_str(f.path))) |
|
123 | 136 | |
@@ -128,7 +141,8 b' class WhooshIndexingDaemon(object):' | |||
|
128 | 141 | |
|
129 | 142 | def get_node(self, repo, path): |
|
130 | 143 | n_path = path[len(repo.path) + 1:] |
|
131 | node = repo.get_changeset().get_node(n_path) | |
|
144 | cs = self._get_index_changeset(repo) | |
|
145 | node = cs.get_node(n_path) | |
|
132 | 146 | return node |
|
133 | 147 | |
|
134 | 148 | def get_node_mtime(self, node): |
@@ -222,7 +236,8 b' class WhooshIndexingDaemon(object):' | |||
|
222 | 236 | :param repo: instance of vcs repo |
|
223 | 237 | """ |
|
224 | 238 | i_cnt = iwc_cnt = 0 |
|
225 |
log.debug('building index for |
|
|
239 | log.debug('building index for %s @revision:%s' % (repo.path, | |
|
240 | self._get_index_revision(repo))) | |
|
226 | 241 | for idx_path in self.get_paths(repo): |
|
227 | 242 | i, iwc = self.add_doc(file_idx_writer, idx_path, repo, repo_name) |
|
228 | 243 | i_cnt += i |
@@ -284,7 +299,6 b' class WhooshIndexingDaemon(object):' | |||
|
284 | 299 | writer.commit(merge=True) |
|
285 | 300 | log.debug('>>> FINISHED REBUILDING CHANGESET INDEX <<<') |
|
286 | 301 | else: |
|
287 | writer.cancel | |
|
288 | 302 | log.debug('>> NOTHING TO COMMIT TO CHANGESET INDEX<<') |
|
289 | 303 | |
|
290 | 304 | def update_file_index(self): |
General Comments 0
You need to be logged in to leave comments.
Login now