##// END OF EJS Templates
[PATCH] Add RSS support to hgweb...
mpm@selenic.com -
r599:765182a4 default
parent child Browse files
Show More
@@ -0,0 +1,6 b''
1 #header#
2 <title>#repo|escape# Changelog</title>
3 <description>#repo|escape# Changelog</description>
4 #entries#
5 </channel>
6 </rss> No newline at end of file
@@ -0,0 +1,7 b''
1 <item>
2 <title>#desc|firstline|escape#</title>
3 <link>http://127.0.0.1:8000/?cmd=changeset;node=#node#"</link>
4 <description>#desc|escape|addbreaks#</description>
5 <author>#author|obfuscate#</author>
6 <pubDate>#date|rfc822date#</pubDate>
7 </item>
@@ -0,0 +1,6 b''
1 #header#
2 <title>#repo|escape#: #file# history</title>
3 <description>#file# revision history</description>
4 #entries#
5 </channel>
6 </rss> No newline at end of file
@@ -0,0 +1,7 b''
1 <item>
2 <title>#desc|firstline|escape#</title>
3 <link>http://127.0.0.1:8000/?cmd=file;file=#file#;filenode=#filenode#"</link>
4 <description>#desc|escape|addbreaks#</description>
5 <author>#author|obfuscate#</author>
6 <pubDate>#date|rfc822date#</pubDate>>
7 </item>
@@ -0,0 +1,6 b''
1 Content-type: text/xml
2
3 <rss version="2.0">
4 <channel>
5 <link>#url#</link>
6 <language>en-us</language>
@@ -0,0 +1,5 b''
1 header = header-rss.tmpl
2 changelog = changelog-rss.tmpl
3 changelogentry = changelogentry-rss.tmpl
4 filelog = filelog-rss.tmpl
5 filelogentry = filelogentry-rss.tmpl
@@ -108,6 +108,12 b' class templater:'
108 tmpl = self.cache[t] = file(self.map[t]).read()
108 tmpl = self.cache[t] = file(self.map[t]).read()
109 return template(tmpl, self.filters, **map)
109 return template(tmpl, self.filters, **map)
110
110
111 def rfc822date(x):
112 month= [None,"Jan", "Feb", "Mar", "Apr", "May", "Jun",
113 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
114 yyyy,mon,dd,hh,mm,ss,wd,x,y = time.gmtime(x)
115 return "%d %s %d %d:%d:%d"%(dd, month[mon], yyyy, hh, mm, ss)
116
111 class hgweb:
117 class hgweb:
112 maxchanges = 10
118 maxchanges = 10
113 maxfiles = 10
119 maxfiles = 10
@@ -127,7 +133,8 b' class hgweb:'
127 "obfuscate": obfuscate,
133 "obfuscate": obfuscate,
128 "short": (lambda x: x[:12]),
134 "short": (lambda x: x[:12]),
129 "firstline": (lambda x: x.splitlines(1)[0]),
135 "firstline": (lambda x: x.splitlines(1)[0]),
130 "permissions": (lambda x: x and "-rwxr-xr-x" or "-rw-r--r--")
136 "permissions": (lambda x: x and "-rwxr-xr-x" or "-rw-r--r--"),
137 "rfc822date": rfc822date,
131 }
138 }
132
139
133 def refresh(self):
140 def refresh(self):
@@ -217,7 +224,12 b' class hgweb:'
217 yield diffblock(mdiff.unidiff(to, date1, tn, date2, f), f, tn)
224 yield diffblock(mdiff.unidiff(to, date1, tn, date2, f), f, tn)
218
225
219 def header(self):
226 def header(self):
220 yield self.t("header", repo = self.reponame)
227 port = os.environ["SERVER_PORT"]
228 port = port != "80" and (":" + port) or ""
229 self.url = "http://%s%s%s" % \
230 (os.environ["SERVER_NAME"], port, os.environ["REQUEST_URI"])
231
232 yield self.t("header", repo = self.reponame, url = self.url)
221
233
222 def footer(self):
234 def footer(self):
223 yield self.t("footer", repo = self.reponame)
235 yield self.t("footer", repo = self.reponame)
@@ -729,6 +741,9 b' def server(path, name, templates, addres'
729 env = {}
741 env = {}
730 env['GATEWAY_INTERFACE'] = 'CGI/1.1'
742 env['GATEWAY_INTERFACE'] = 'CGI/1.1'
731 env['REQUEST_METHOD'] = self.command
743 env['REQUEST_METHOD'] = self.command
744 env['SERVER_NAME'] = self.server.server_name
745 env['SERVER_PORT'] = str(self.server.server_port)
746 env['REQUEST_URI'] = "/"
732 if query:
747 if query:
733 env['QUERY_STRING'] = query
748 env['QUERY_STRING'] = query
734 host = self.address_string()
749 host = self.address_string()
@@ -6,6 +6,7 b''
6 <div class="buttons">
6 <div class="buttons">
7 <a href="?cmd=tags">tags</a>
7 <a href="?cmd=tags">tags</a>
8 <a href="?cmd=manifest;manifest=#manifest#;path=/">manifest</a>
8 <a href="?cmd=manifest;manifest=#manifest#;path=/">manifest</a>
9 <a href="?cmd=changelog;style=rss">rss</a>
9 </div>
10 </div>
10
11
11 <h2>changelog for #repo|escape#</h2>
12 <h2>changelog for #repo|escape#</h2>
@@ -8,6 +8,7 b''
8 <a href="?cmd=tags">tags</a>
8 <a href="?cmd=tags">tags</a>
9 <a href="?cmd=file;file=#file#;filenode=#filenode#">file</a>
9 <a href="?cmd=file;file=#file#;filenode=#filenode#">file</a>
10 <a href="?cmd=annotate;file=#file#;filenode=#filenode#">annotate</a>
10 <a href="?cmd=annotate;file=#file#;filenode=#filenode#">annotate</a>
11 <a href="?cmd=filelog;file=#file#;filenode=0;style=rss">rss</a>
11 </div>
12 </div>
12
13
13 <h2>#file# revision history</h2>
14 <h2>#file# revision history</h2>
General Comments 0
You need to be logged in to leave comments. Login now