diff --git a/mercurial/hgweb.py b/mercurial/hgweb.py
--- a/mercurial/hgweb.py
+++ b/mercurial/hgweb.py
@@ -108,6 +108,12 @@ class templater:
tmpl = self.cache[t] = file(self.map[t]).read()
return template(tmpl, self.filters, **map)
+def rfc822date(x):
+ month= [None,"Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
+ yyyy,mon,dd,hh,mm,ss,wd,x,y = time.gmtime(x)
+ return "%d %s %d %d:%d:%d"%(dd, month[mon], yyyy, hh, mm, ss)
+
class hgweb:
maxchanges = 10
maxfiles = 10
@@ -127,7 +133,8 @@ class hgweb:
"obfuscate": obfuscate,
"short": (lambda x: x[:12]),
"firstline": (lambda x: x.splitlines(1)[0]),
- "permissions": (lambda x: x and "-rwxr-xr-x" or "-rw-r--r--")
+ "permissions": (lambda x: x and "-rwxr-xr-x" or "-rw-r--r--"),
+ "rfc822date": rfc822date,
}
def refresh(self):
@@ -217,7 +224,12 @@ class hgweb:
yield diffblock(mdiff.unidiff(to, date1, tn, date2, f), f, tn)
def header(self):
- yield self.t("header", repo = self.reponame)
+ port = os.environ["SERVER_PORT"]
+ port = port != "80" and (":" + port) or ""
+ self.url = "http://%s%s%s" % \
+ (os.environ["SERVER_NAME"], port, os.environ["REQUEST_URI"])
+
+ yield self.t("header", repo = self.reponame, url = self.url)
def footer(self):
yield self.t("footer", repo = self.reponame)
@@ -729,6 +741,9 @@ def server(path, name, templates, addres
env = {}
env['GATEWAY_INTERFACE'] = 'CGI/1.1'
env['REQUEST_METHOD'] = self.command
+ env['SERVER_NAME'] = self.server.server_name
+ env['SERVER_PORT'] = str(self.server.server_port)
+ env['REQUEST_URI'] = "/"
if query:
env['QUERY_STRING'] = query
host = self.address_string()
diff --git a/templates/changelog-rss.tmpl b/templates/changelog-rss.tmpl
new file mode 100644
--- /dev/null
+++ b/templates/changelog-rss.tmpl
@@ -0,0 +1,6 @@
+#header#
+
#repo|escape# Changelog
+ #repo|escape# Changelog
+ #entries#
+
+
\ No newline at end of file
diff --git a/templates/changelog.tmpl b/templates/changelog.tmpl
--- a/templates/changelog.tmpl
+++ b/templates/changelog.tmpl
@@ -6,6 +6,7 @@
changelog for #repo|escape#
diff --git a/templates/changelogentry-rss.tmpl b/templates/changelogentry-rss.tmpl
new file mode 100644
--- /dev/null
+++ b/templates/changelogentry-rss.tmpl
@@ -0,0 +1,7 @@
+-
+ #desc|firstline|escape#
+ http://127.0.0.1:8000/?cmd=changeset;node=#node#"
+ #desc|escape|addbreaks#
+ #author|obfuscate#
+ #date|rfc822date#
+
diff --git a/templates/filelog-rss.tmpl b/templates/filelog-rss.tmpl
new file mode 100644
--- /dev/null
+++ b/templates/filelog-rss.tmpl
@@ -0,0 +1,6 @@
+#header#
+ #repo|escape#: #file# history
+ #file# revision history
+ #entries#
+
+
\ No newline at end of file
diff --git a/templates/filelog.tmpl b/templates/filelog.tmpl
--- a/templates/filelog.tmpl
+++ b/templates/filelog.tmpl
@@ -8,6 +8,7 @@
tags
file
annotate
+rss
#file# revision history
diff --git a/templates/filelogentry-rss.tmpl b/templates/filelogentry-rss.tmpl
new file mode 100644
--- /dev/null
+++ b/templates/filelogentry-rss.tmpl
@@ -0,0 +1,7 @@
+-
+ #desc|firstline|escape#
+ http://127.0.0.1:8000/?cmd=file;file=#file#;filenode=#filenode#"
+ #desc|escape|addbreaks#
+ #author|obfuscate#
+ #date|rfc822date#>
+
diff --git a/templates/header-rss.tmpl b/templates/header-rss.tmpl
new file mode 100644
--- /dev/null
+++ b/templates/header-rss.tmpl
@@ -0,0 +1,6 @@
+Content-type: text/xml
+
+
+
+ #url#
+ en-us
diff --git a/templates/map-rss b/templates/map-rss
new file mode 100644
--- /dev/null
+++ b/templates/map-rss
@@ -0,0 +1,5 @@
+header = header-rss.tmpl
+changelog = changelog-rss.tmpl
+changelogentry = changelogentry-rss.tmpl
+filelog = filelog-rss.tmpl
+filelogentry = filelogentry-rss.tmpl