Mercurial > kallithea
comparison rhodecode/lib/indexers/__init__.py @ 2373:1828eb7fa688 beta
#469 added --update-only option to whoosh to re-index only given list
of repos in index
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 02 Jun 2012 18:01:56 +0200 |
parents | 4c239e0dcbb7 |
children | a0ef98f2520b |
comparison
equal
deleted
inserted
replaced
2372:95bea8088213 | 2373:1828eb7fa688 |
---|---|
91 index_location = config['index_dir'] | 91 index_location = config['index_dir'] |
92 repo_location = self.options.repo_location \ | 92 repo_location = self.options.repo_location \ |
93 if self.options.repo_location else RepoModel().repos_path | 93 if self.options.repo_location else RepoModel().repos_path |
94 repo_list = map(strip, self.options.repo_list.split(',')) \ | 94 repo_list = map(strip, self.options.repo_list.split(',')) \ |
95 if self.options.repo_list else None | 95 if self.options.repo_list else None |
96 repo_update_list = map(strip, self.options.repo_update_list.split(',')) \ | |
97 if self.options.repo_update_list else None | |
96 load_rcextensions(config['here']) | 98 load_rcextensions(config['here']) |
97 #====================================================================== | 99 #====================================================================== |
98 # WHOOSH DAEMON | 100 # WHOOSH DAEMON |
99 #====================================================================== | 101 #====================================================================== |
100 from rhodecode.lib.pidlock import LockHeld, DaemonLock | 102 from rhodecode.lib.pidlock import LockHeld, DaemonLock |
101 from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon | 103 from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon |
102 try: | 104 try: |
103 l = DaemonLock(file_=jn(dn(dn(index_location)), 'make_index.lock')) | 105 l = DaemonLock(file_=jn(dn(dn(index_location)), 'make_index.lock')) |
104 WhooshIndexingDaemon(index_location=index_location, | 106 WhooshIndexingDaemon(index_location=index_location, |
105 repo_location=repo_location, | 107 repo_location=repo_location, |
106 repo_list=repo_list,)\ | 108 repo_list=repo_list, |
109 repo_update_list=repo_update_list)\ | |
107 .run(full_index=self.options.full_index) | 110 .run(full_index=self.options.full_index) |
108 l.release() | 111 l.release() |
109 except LockHeld: | 112 except LockHeld: |
110 sys.exit(1) | 113 sys.exit(1) |
111 | 114 |
117 ) | 120 ) |
118 self.parser.add_option('--index-only', | 121 self.parser.add_option('--index-only', |
119 action='store', | 122 action='store', |
120 dest='repo_list', | 123 dest='repo_list', |
121 help="Specifies a comma separated list of repositores " | 124 help="Specifies a comma separated list of repositores " |
122 "to build index on OPTIONAL", | 125 "to build index on. If not given all repositories " |
126 "are scanned for indexing. OPTIONAL", | |
127 ) | |
128 self.parser.add_option('--update-only', | |
129 action='store', | |
130 dest='repo_update_list', | |
131 help="Specifies a comma separated list of repositores " | |
132 "to re-build index on. OPTIONAL", | |
123 ) | 133 ) |
124 self.parser.add_option('-f', | 134 self.parser.add_option('-f', |
125 action='store_true', | 135 action='store_true', |
126 dest='full_index', | 136 dest='full_index', |
127 help="Specifies that index should be made full i.e" | 137 help="Specifies that index should be made full i.e" |