# HG changeset patch # User Mads Kiilerich <madski@unity3d.com> # Date 2013-04-03 15:20:32 # Node ID c78de39f30fcaedeeb19c6711a853d242bdccf54 # Parent ec6354949623e20960f9f5ee11946f54d1aa6f84 summary: redirect from repo URLs with #branchname to changelog with this branch This implements partial support for the Mercurial syntax for specifying revisions so https://secure.rhodecode.org/rhodecode/#beta works both for pulling with Mercurial and browsing. This uses javascript, and has a bit of extra support for onhashchange in HTML5 browsers. diff --git a/rhodecode/templates/summary/summary.html b/rhodecode/templates/summary/summary.html --- a/rhodecode/templates/summary/summary.html +++ b/rhodecode/templates/summary/summary.html @@ -15,6 +15,21 @@ <%def name="head_extra()"> <link href="${h.url('atom_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" /> <link href="${h.url('rss_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" /> + +<script> +redirect_hash_branch = function(){ + var branch = window.location.hash.replace(/^#(.*)/, '$1'); + if (branch){ + window.location = "${h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__')}" + .replace('__BRANCH__',branch); + } +} +redirect_hash_branch(); +window.onhashchange = function() { + redirect_hash_branch(); +}; +</script> + </%def> <%def name="main()">