Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/webcommands.py @ 19533:9a020b354d93
hgweb: separate search itself and template generation
This will make it simpler to add other search modes.
author | Alexander Plavin <alexander@plav.in> |
---|---|
date | Mon, 15 Jul 2013 01:10:22 +0400 |
parents | 81318ca090a2 |
children | 983bb4069004 |
comparison
equal
deleted
inserted
replaced
19532:b5e3f2b1d5e9 | 19533:9a020b354d93 |
---|---|
108 except ErrorResponse: | 108 except ErrorResponse: |
109 raise inst | 109 raise inst |
110 | 110 |
111 def _search(web, req, tmpl): | 111 def _search(web, req, tmpl): |
112 | 112 |
113 def changelist(**map): | 113 def keywordsearch(): |
114 count = 0 | |
115 lower = encoding.lower | 114 lower = encoding.lower |
116 qw = lower(query).split() | 115 qw = lower(query).split() |
117 | 116 |
118 def revgen(): | 117 def revgen(): |
119 cl = web.repo.changelog | 118 cl = web.repo.changelog |
135 miss = 1 | 134 miss = 1 |
136 break | 135 break |
137 if miss: | 136 if miss: |
138 continue | 137 continue |
139 | 138 |
139 yield ctx | |
140 | |
141 def changelist(**map): | |
142 count = 0 | |
143 | |
144 for ctx in keywordsearch(): | |
140 count += 1 | 145 count += 1 |
141 n = ctx.node() | 146 n = ctx.node() |
142 showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n) | 147 showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n) |
143 files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) | 148 files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) |
144 | 149 |