Show More
@@ -0,0 +1,28 b'' | |||||
|
1 | #header# | |||
|
2 | <title>#repo|escape#: searching for #query|escape#</title> | |||
|
3 | </head> | |||
|
4 | <body> | |||
|
5 | ||||
|
6 | <div class="buttons"> | |||
|
7 | <a href="?cmd=changelog;rev=#rev#">changelog</a> | |||
|
8 | <a href="?cmd=tags">tags</a> | |||
|
9 | <a href="?cmd=manifest;manifest=#manifest#;path=/">manifest</a> | |||
|
10 | </div> | |||
|
11 | ||||
|
12 | <h2>searching for #query|escape#</h2> | |||
|
13 | ||||
|
14 | <form> | |||
|
15 | search: | |||
|
16 | <input type="hidden" name="cmd" value="changelog"> | |||
|
17 | <input name="rev" type="text" width="30" value="#query|escape#"> | |||
|
18 | </form> | |||
|
19 | ||||
|
20 | #entries# | |||
|
21 | ||||
|
22 | <form> | |||
|
23 | search: | |||
|
24 | <input type="hidden" name="cmd" value="changelog"> | |||
|
25 | <input name="rev" type="text" width="30"> | |||
|
26 | </form> | |||
|
27 | ||||
|
28 | #footer# |
@@ -0,0 +1,22 b'' | |||||
|
1 | <div class="parity#parity#"> | |||
|
2 | <table width="100%" cellpadding="0" cellspacing="0"> | |||
|
3 | <tr> | |||
|
4 | <td align="right" width="15%"><b>#date|age# ago: </b></td> | |||
|
5 | <td><b>#desc|firstline|escape#</b></td></tr> | |||
|
6 | <tr> | |||
|
7 | <td align="right">changeset #rev#: </td> | |||
|
8 | <td><a href="?cmd=changeset;node=#node#">#node|short#</a></td></tr> | |||
|
9 | #parent1# | |||
|
10 | #parent2# | |||
|
11 | <tr> | |||
|
12 | <td align="right">author: </td> | |||
|
13 | <td>#author|obfuscate#</td></tr> | |||
|
14 | <tr> | |||
|
15 | <td align="right">date: </td> | |||
|
16 | <td>#date|date#</td></tr> | |||
|
17 | <tr> | |||
|
18 | <td align="right" valign="top"><a href="?cmd=manifest;manifest=#manifest#;path=/">files</a>: </td> | |||
|
19 | <td>#files#</td></tr> | |||
|
20 | </table> | |||
|
21 | </div> | |||
|
22 |
@@ -286,6 +286,68 b' class hgweb:' | |||||
286 | manifest = hex(mf), |
|
286 | manifest = hex(mf), | |
287 | rev = pos, changesets = count, entries = changelist) |
|
287 | rev = pos, changesets = count, entries = changelist) | |
288 |
|
288 | |||
|
289 | def search(self, query): | |||
|
290 | ||||
|
291 | def changelist(): | |||
|
292 | cl = self.repo.changelog | |||
|
293 | count = 0 | |||
|
294 | qw = query.lower().split() | |||
|
295 | ||||
|
296 | def revgen(): | |||
|
297 | for i in range(cl.count() - 1, 0, -100): | |||
|
298 | l = [] | |||
|
299 | for j in range(max(0, i - 100), i): | |||
|
300 | n = cl.node(j) | |||
|
301 | changes = cl.read(n) | |||
|
302 | l.insert(0, (n, j, changes)) | |||
|
303 | for e in l: | |||
|
304 | yield e | |||
|
305 | ||||
|
306 | for n, i, changes in revgen(): | |||
|
307 | miss = 0 | |||
|
308 | for q in qw: | |||
|
309 | if not (q in changes[1].lower() or | |||
|
310 | q in changes[4].lower() or | |||
|
311 | q in " ".join(changes[3][:20]).lower()): | |||
|
312 | miss = 1 | |||
|
313 | break | |||
|
314 | if miss: continue | |||
|
315 | ||||
|
316 | count += 1 | |||
|
317 | hn = hex(n) | |||
|
318 | p1, p2 = cl.parents(n) | |||
|
319 | t = float(changes[2].split(' ')[0]) | |||
|
320 | ||||
|
321 | yield self.t( | |||
|
322 | 'searchentry', | |||
|
323 | parity = count & 1, | |||
|
324 | author = changes[1], | |||
|
325 | parent1 = self.parent("changelogparent", | |||
|
326 | hex(p1), cl.rev(p1)), | |||
|
327 | parent2 = self.parent("changelogparent", | |||
|
328 | hex(p2), cl.rev(p2)), | |||
|
329 | p1 = hex(p1), p2 = hex(p2), | |||
|
330 | p1rev = cl.rev(p1), p2rev = cl.rev(p2), | |||
|
331 | manifest = hex(changes[0]), | |||
|
332 | desc = changes[4], | |||
|
333 | date = t, | |||
|
334 | files = self.listfilediffs(changes[3], n), | |||
|
335 | rev = i, | |||
|
336 | node = hn) | |||
|
337 | ||||
|
338 | if count >= self.maxchanges: break | |||
|
339 | ||||
|
340 | cl = self.repo.changelog | |||
|
341 | mf = cl.read(cl.tip())[0] | |||
|
342 | ||||
|
343 | yield self.t('search', | |||
|
344 | header = self.header(), | |||
|
345 | footer = self.footer(), | |||
|
346 | query = query, | |||
|
347 | repo = self.reponame, | |||
|
348 | manifest = hex(mf), | |||
|
349 | entries = changelist) | |||
|
350 | ||||
289 | def changeset(self, nodeid): |
|
351 | def changeset(self, nodeid): | |
290 | n = bin(nodeid) |
|
352 | n = bin(nodeid) | |
291 | cl = self.repo.changelog |
|
353 | cl = self.repo.changelog | |
@@ -586,12 +648,15 b' class hgweb:' | |||||
586 | self.t = templater(m, self.filters) |
|
648 | self.t = templater(m, self.filters) | |
587 |
|
649 | |||
588 | if not args.has_key('cmd') or args['cmd'][0] == 'changelog': |
|
650 | if not args.has_key('cmd') or args['cmd'][0] == 'changelog': | |
589 |
|
|
651 | c = self.repo.changelog.count() - 1 | |
|
652 | hi = c | |||
590 | if args.has_key('rev'): |
|
653 | if args.has_key('rev'): | |
591 | hi = args['rev'][0] |
|
654 | hi = args['rev'][0] | |
592 | try: |
|
655 | try: | |
593 | hi = self.repo.changelog.rev(self.repo.lookup(hi)) |
|
656 | hi = self.repo.changelog.rev(self.repo.lookup(hi)) | |
594 |
except KeyError: |
|
657 | except KeyError: | |
|
658 | write(self.search(hi)) | |||
|
659 | return | |||
595 |
|
660 | |||
596 | write(self.changelog(hi)) |
|
661 | write(self.changelog(hi)) | |
597 |
|
662 |
@@ -1,11 +1,13 b'' | |||||
1 | header = header.tmpl |
|
1 | header = header.tmpl | |
2 | footer = footer.tmpl |
|
2 | footer = footer.tmpl | |
|
3 | search = search.tmpl | |||
3 | changelog = changelog.tmpl |
|
4 | changelog = changelog.tmpl | |
4 | naventry = "<a href="?cmd=changelog;rev=#rev#">#label#</a> " |
|
5 | naventry = "<a href="?cmd=changelog;rev=#rev#">#label#</a> " | |
5 | filedifflink = "<a href="?cmd=filediff;node=#node#;file=#file#">#file#</a> " |
|
6 | filedifflink = "<a href="?cmd=filediff;node=#node#;file=#file#">#file#</a> " | |
6 | filenodelink = "<a href="?cmd=file;filenode=#filenode#;file=#file#">#file#</a> " |
|
7 | filenodelink = "<a href="?cmd=file;filenode=#filenode#;file=#file#">#file#</a> " | |
7 | fileellipses = "..." |
|
8 | fileellipses = "..." | |
8 | changelogentry = changelogentry.tmpl |
|
9 | changelogentry = changelogentry.tmpl | |
|
10 | searchentry = searchentry.tmpl | |||
9 | changeset = changeset.tmpl |
|
11 | changeset = changeset.tmpl | |
10 | manifest = manifest.tmpl |
|
12 | manifest = manifest.tmpl | |
11 | manifestdirentry = "<tr class="parity#parity#"><td><tt>drwxr-xr-x</tt> <td><a href="?cmd=manifest;manifest=#manifest#;path=#path#">#basename#/</a>" |
|
13 | manifestdirentry = "<tr class="parity#parity#"><td><tt>drwxr-xr-x</tt> <td><a href="?cmd=manifest;manifest=#manifest#;path=#path#">#basename#/</a>" |
General Comments 0
You need to be logged in to leave comments.
Login now