Anonymous avatar Anonymous committed f89a244

added browse_tip functionality

Comments (0)

Files changed (3)


 container_auth_enabled = false
 proxypass_auth_enabled = false
 default_encoding = utf8
+browse_tip = true
 ## overwrite schema of clone url
 ## available vars:


 import logging
 import traceback
-from pylons import request, response, tmpl_context as c, url
+from pylons import config, request, response, tmpl_context as c, url
 from pylons.i18n.translation import _
 from pylons.controllers.util import redirect
 from pylons.decorators import jsonify
         cur_rev = c.changeset.revision
+        # If "browse tip" is enabled, browse at tip instead of raw changeset.
+        if config.get('browse_tip', 'false').lower() == 'true' and 'tip' in c.changeset.tags:
+            c.nice_id = 'tip'
+        else: 
+            c.nice_id = c.changeset.raw_id
         # prev link
             prev_rev = c.rhodecode_repo.get_changeset(cur_rev).prev(c.branch)


           		%if c.file.parent:
          		<tr class="parity0">
-	          			${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.file.parent.path),class_="browser-dir ypjax-link")}
+	          			${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.nice_id,f_path=c.file.parent.path),class_="browser-dir ypjax-link")}
 		    %for cnt,node in enumerate(c.file):
 				<tr class="parity${cnt%2}">
-                        ${h.link_to(,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=h.safe_unicode(node.path)),class_=file_class(node)+" ypjax-link")}
+                        ${h.link_to(,h.url('files_home',repo_name=c.repo_name,revision=c.nice_id,f_path=h.safe_unicode(node.path)),class_=file_class(node)+" ypjax-link")}
 		             %if node.is_file():
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.