Mercurial > hg
changeset 168:65cf1b0cfe86
hgweb: add tags links and manifest links
This adds a simple new tags page to browse by tag, adds the tag link
everywhere, and adds manifest links to the tags and changelog pages.
author | mpm@selenic.com |
---|---|
date | Thu, 26 May 2005 12:24:01 -0800 |
parents | fad9ad1ec7c7 |
children | e93a16de0c66 |
files | mercurial/hgweb.py templates/changelog.tmpl templates/changeset.tmpl templates/fileannotate.tmpl templates/filediff.tmpl templates/filelog.tmpl templates/filerevision.tmpl templates/header.tmpl templates/manifest.tmpl templates/map |
diffstat | 10 files changed, 46 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb.py Thu May 26 11:15:05 2005 -0800 +++ b/mercurial/hgweb.py Thu May 26 12:24:01 2005 -0800 @@ -240,7 +240,9 @@ yield l - count = self.repo.changelog.count() + cl = self.repo.changelog + mf = cl.read(cl.tip())[0] + count = cl.count() pos = pos or count - 1 end = min(pos, count - 1) start = max(0, pos - self.maxchanges) @@ -251,6 +253,7 @@ footer = self.footer(), repo = self.reponame, changenav = changenav, + manifest = hex(mf), rev = pos, changesets = count, entries = changelist) def changeset(self, nodeid): @@ -492,6 +495,30 @@ up = up(path), entries = filelist) + def tags(self): + cl = self.repo.changelog + mf = cl.read(cl.tip())[0] + + self.repo.lookup(0) # prime the cache + i = self.repo.tags.items() + i.sort() + + def entries(): + parity = 0 + for k,n in i: + yield self.t("tagentry", + parity = parity, + tag = k, + node = hex(n)) + parity = 1 - parity + + yield self.t("tags", + header = self.header(), + footer = self.footer(), + repo = self.reponame, + manifest = hex(mf), + entries = entries) + def filediff(self, file, changeset): n = bin(changeset) cl = self.repo.changelog @@ -538,6 +565,9 @@ elif args['cmd'][0] == 'manifest': write(self.manifest(args['manifest'][0], args['path'][0])) + elif args['cmd'][0] == 'tags': + write(self.tags()) + elif args['cmd'][0] == 'filediff': write(self.filediff(args['file'][0], args['node'][0]))
--- a/templates/changelog.tmpl Thu May 26 11:15:05 2005 -0800 +++ b/templates/changelog.tmpl Thu May 26 12:24:01 2005 -0800 @@ -2,6 +2,12 @@ <title>#repo#: changelog</title> </head> <body> + +<div class="buttons"> +<a href="?cmd=tags">tags</a> +<a href="?cmd=manifest;manifest=#manifest#;path=/">manifest</a> +</div> + <h2>changelog for #repo#</h2> <form>
--- a/templates/changeset.tmpl Thu May 26 11:15:05 2005 -0800 +++ b/templates/changeset.tmpl Thu May 26 12:24:01 2005 -0800 @@ -5,6 +5,7 @@ <div class="buttons"> <a href="?cmd=changelog;rev=#rev#">changelog</a> +<a href="?cmd=tags">tags</a> <a href="?cmd=manifest;manifest=#manifest#;path=/">manifest</a> </div>
--- a/templates/fileannotate.tmpl Thu May 26 11:15:05 2005 -0800 +++ b/templates/fileannotate.tmpl Thu May 26 12:24:01 2005 -0800 @@ -5,6 +5,7 @@ <div class="buttons"> <a href="?cmd=changelog;rev=#rev#">changelog</a> +<a href="?cmd=tags">tags</a> <a href="?cmd=changeset;node=#node#">changeset</a> <a href="?cmd=manifest;manifest=#manifest#;path=#path#">manifest</a> <a href="?cmd=file;file=#file#;filenode=#filenode#">file</a>
--- a/templates/filediff.tmpl Thu May 26 11:15:05 2005 -0800 +++ b/templates/filediff.tmpl Thu May 26 12:24:01 2005 -0800 @@ -5,6 +5,7 @@ <div class="buttons"> <a href="?cmd=changelog;rev=#rev#">changelog</a> +<a href="?cmd=tags">tags</a> <a href="?cmd=changeset;node=#node#">changeset</a> <a href="?cmd=file;file=#file#;filenode=#filenode#">file</a> <a href="?cmd=filelog;file=#file#;filenode=#filenode#">revisions</a>
--- a/templates/filelog.tmpl Thu May 26 11:15:05 2005 -0800 +++ b/templates/filelog.tmpl Thu May 26 12:24:01 2005 -0800 @@ -5,6 +5,7 @@ <div class="buttons"> <a href="?cmd=changelog">changelog</a> +<a href="?cmd=tags">tags</a> <a href="?cmd=file;file=#file#;filenode=#filenode#">file</a> <a href="?cmd=annotate;file=#file#;filenode=#filenode#">annotate</a> </div>
--- a/templates/filerevision.tmpl Thu May 26 11:15:05 2005 -0800 +++ b/templates/filerevision.tmpl Thu May 26 12:24:01 2005 -0800 @@ -5,6 +5,7 @@ <div class="buttons"> <a href="?cmd=changelog;rev=#rev#">changelog</a> +<a href="?cmd=tags">tags</a> <a href="?cmd=changeset;node=#node#">changeset</a> <a href="?cmd=manifest;manifest=#manifest#;path=#path#">manifest</a> <a href="?cmd=filelog;file=#file#;filenode=#filenode#">revisions</a>
--- a/templates/header.tmpl Thu May 26 11:15:05 2005 -0800 +++ b/templates/header.tmpl Thu May 26 12:24:01 2005 -0800 @@ -6,7 +6,7 @@ <style type="text/css"> a { text-decoration:none; } .parity0 { background-color: #eeeeee; } -.parity1 { background-color: #ffffff; } +.parity1 { background-color: #f8f8f8; } .lineno { width: 60px; color: #cccccc; font-size: smaller; } .plusline { color: green; } .minusline { color: red; }
--- a/templates/manifest.tmpl Thu May 26 11:15:05 2005 -0800 +++ b/templates/manifest.tmpl Thu May 26 12:24:01 2005 -0800 @@ -5,6 +5,7 @@ <div class="buttons"> <a href="?cmd=changelog;rev=#rev#">changelog</a> +<a href="?cmd=tags">tags</a> <a href="?cmd=changeset;node=#node#">changeset</a> </div>
--- a/templates/map Thu May 26 11:15:05 2005 -0800 +++ b/templates/map Thu May 26 12:24:01 2005 -0800 @@ -25,3 +25,5 @@ changesetparent = "<tr><td class="metatag">parent:</td><td><a href="?cmd=changeset;node=#node#">#node#</a></td></tr>" filerevparent = "<tr><td class="metatag">parent:</td><td><a href="?cmd=file;file=#file#;filenode=#node#">#node#</a></td></tr>" fileannotateparent = "<tr><td class="metatag">parent:</td><td><a href="?cmd=annotate;file=#file#;filenode=#node#">#node#</a></td></tr>" +tags = tags.tmpl +tagentry = "<div class="parity#parity#"><tt>#node#</tt> <a href="?cmd=changeset;node=#node#">#tag#</a><br /></div>"