# HG changeset patch # User Anton Shestakov # Date 1436695488 -28800 # Node ID cd842821db2c185d350e0d12134c7a9db1036607 # Parent 3a33412792f1e5274ccbc0ae4a4d924012bf7dc6 hgweb: provide links to branches, tags and bookmarks by name (paper and coal) It's sometimes handy to, say, have a url always point to branch head, not just at the current branch head by node hash. Previously, this was only possible by manually editing url and replacing node hash with branch/tag/bookmark name. It wasn't very convenient, or easy - in case the name contained special characters that needed to be urlencoded. Let's have /branches, /tags and /bookmarks pages in paper and coal style provide links both to symbolic revisions and to node hashes. This feature was wished for in issue3594. diff -r 3a33412792f1 -r cd842821db2c mercurial/templates/coal/map --- a/mercurial/templates/coal/map Sun Jul 12 16:47:56 2015 +0800 +++ b/mercurial/templates/coal/map Sun Jul 12 18:04:48 2015 +0800 @@ -158,36 +158,42 @@ tagentry = ' - + {tag|escape} - {node|short} + + {node|short} + ' bookmarks = ../paper/bookmarks.tmpl bookmarkentry = ' - + {bookmark|escape} - {node|short} + + {node|short} + ' branches = ../paper/branches.tmpl branchentry = ' - + {branch|escape} - {node|short} + + {node|short} + ' changelogtag = '{name|escape} ' diff -r 3a33412792f1 -r cd842821db2c mercurial/templates/paper/map --- a/mercurial/templates/paper/map Sun Jul 12 16:47:56 2015 +0800 +++ b/mercurial/templates/paper/map Sun Jul 12 18:04:48 2015 +0800 @@ -161,36 +161,42 @@ tagentry = ' - + {tag|escape} - {node|short} + + {node|short} + ' bookmarks = bookmarks.tmpl bookmarkentry = ' - + {bookmark|escape} - {node|short} + + {node|short} + ' branches = branches.tmpl branchentry = ' - + {branch|escape} - {node|short} + + {node|short} + ' changelogtag = '{name|escape} ' diff -r 3a33412792f1 -r cd842821db2c tests/test-hgweb-symrev.t --- a/tests/test-hgweb-symrev.t Sun Jul 12 16:47:56 2015 +0800 +++ b/tests/test-hgweb-symrev.t Sun Jul 12 18:04:48 2015 +0800 @@ -33,7 +33,7 @@ $ hg serve --config web.allow_archive=zip -n test -p $HGPORT -d --pid-file=hg.pid -E errors.log $ cat hg.pid >> $DAEMON_PIDS - $ REVLINKS='href=[^>]+(rev=|/)(43c799df6e75|0|a7c1559b7bba|1|xyzzy|9d8c40cba617|2|tip)' + $ REVLINKS='href=[^>]+(rev=|/)(43c799df6e75|0|a7c1559b7bba|1|xyzzy|9d8c40cba617|2|tip|default)' (De)referencing symbolic revisions (paper) @@ -74,6 +74,18 @@ + $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'branches?style=paper' | egrep $REVLINKS + + + + $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'tags?style=paper' | egrep $REVLINKS + + + + $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'bookmarks?style=paper' | egrep $REVLINKS + + + $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'shortlog?style=paper&rev=all()' | egrep $REVLINKS third second @@ -249,6 +261,18 @@ + $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'branches?style=coal' | egrep $REVLINKS + + + + $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'tags?style=coal' | egrep $REVLINKS + + + + $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'bookmarks?style=coal' | egrep $REVLINKS + + + $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'shortlog?style=coal&rev=all()' | egrep $REVLINKS third second