[PATCH] templates/raw: define key "changelog"

Adrian Buehlmann adrian at cadifra.com
Sun Mar 16 13:46:22 CDT 2008


This patch implements "raw-log" URL.

I've applied it to my Mercurial installation here:

http://www.cadifra.com/cgi-bin/repos/tortoisehg-abuehl/log
http://www.cadifra.com/cgi-bin/repos/tortoisehg-abuehl/raw-log

The latter can also be accessed as

http://www.cadifra.com/cgi-bin/repos/tortoisehg-abuehl/log?style=raw

Currently, raw returns a traceback for log. Compare:

http://selenic.com/repo/hg/log      (fine)
http://selenic.com/repo/hg/raw-log  (error)

We already have raw-rev and raw-file:

http://selenic.com/repo/index.cgi/hg/file/c50ac875ffcb/README
http://selenic.com/repo/index.cgi/hg/rev/c50ac875ffcb

http://selenic.com/repo/index.cgi/hg/raw-file/c50ac875ffcb/README
http://selenic.com/repo/index.cgi/hg/raw-rev/c50ac875ffcb

http://selenic.com/repo/index.cgi/hg/file/c50ac875ffcb/README?style=raw
http://selenic.com/repo/index.cgi/hg/rev/c50ac875ffcb?style=raw

I believe raw-log would be a natural completion.

Warning 1: Matt might not be happy with this patch. See
http://www.selenic.com/mercurial/bts/issue1025

Warning 2: This is my first patch I've ever sent to mercurial-devel

# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1205677235 -3600
# Node ID 8efa5c33a669364df156517c1bf6c8655af530a7
# Parent  90a4329a6b4af35556e5ecf74837bc9ac7b56495
templates/raw: define key "changelog"

Without this change, starting "hg serve" and browsing to http://localhost:8000/raw-log
(an alias of http://localhost:8000/log?style=raw) returns the traceback
"KeyError: 'changelog'".

With this change, a raw changelog is returned, containing the same changesets
as http://localhost:8000/log. The format used is the same as "hg log".

diff --git a/templates/raw/changelog.tmpl b/templates/raw/changelog.tmpl
new file mode 100644
--- /dev/null
+++ b/templates/raw/changelog.tmpl
@@ -0,0 +1,2 @@
+#header#
+#entries%logentry#
diff --git a/templates/raw/changelogentry.tmpl b/templates/raw/changelogentry.tmpl
new file mode 100644
--- /dev/null
+++ b/templates/raw/changelogentry.tmpl
@@ -0,0 +1,5 @@
+changeset:   {rev}:{node|short}#inbranch%logbranch##branches%logbranch##logtag##parent%logparent#
+user:        {author}
+date:        {date|date}
+summary:     {desc|firstline}
+
diff --git a/templates/raw/map b/templates/raw/map
--- a/templates/raw/map
+++ b/templates/raw/map
@@ -21,3 +21,8 @@
 notfound = notfound.tmpl
 error = error.tmpl
 indexentry = '#url#\n'
+changelog = changelog.tmpl
+logentry = changelogentry.tmpl
+logparent = '\nparent:      #rev#:#node|short#'
+logtag = '\ntag:         #tag#'
+logbranch = '\nbranch:      #name#'




More information about the Mercurial-devel mailing list