Changeset - c8bd0e6cc3da
[Not reviewed]
beta
0 5 0
Marcin Kuzminski - 15 years ago 2010-11-02 23:28:37
marcin@python-works.com
some changes for #45.
Added warning messages for browsing wrong cs/paths
Cleanup of codes
5 files changed with 35 insertions and 21 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/changeset.py
Show inline comments
 
@@ -27,6 +27,7 @@ from pylons.i18n.translation import _
 
from pylons.controllers.util import redirect
 
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
 
from rhodecode.lib.base import BaseController, render
 
import rhodecode.lib.helpers as h
 
from rhodecode.model.hg import HgModel
 
from vcs.exceptions import RepositoryError, ChangesetError
 
from vcs.nodes import FileNode
 
@@ -59,8 +60,9 @@ class ChangesetController(BaseController
 

	
 
        try:
 
            c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision)
 
        except RepositoryError:
 
        except RepositoryError, e:
 
            log.error(traceback.format_exc())
 
            h.flash(str(e), category='warning')
 
            return redirect(url('home'))
 
        else:
 
            try:
rhodecode/controllers/files.py
Show inline comments
 
@@ -68,7 +68,8 @@ class FilesController(BaseController):
 

	
 

	
 
        try:
 
            cur_rev = repo.get_changeset(revision).revision
 
            c.changeset = repo.get_changeset(revision)
 
            cur_rev = c.changeset.revision
 
            prev_rev = repo.get_changeset(get_prev_rev(cur_rev)).raw_id
 
            next_rev = repo.get_changeset(get_next_rev(cur_rev)).raw_id
 

	
 
@@ -77,15 +78,19 @@ class FilesController(BaseController):
 
            c.url_next = url('files_home', repo_name=c.repo_name,
 
                             revision=next_rev, f_path=f_path)
 

	
 
            c.changeset = repo.get_changeset(revision)
 

	
 
            c.cur_rev = c.changeset.raw_id
 
            c.rev_nr = c.changeset.revision
 
            try:
 
            c.files_list = c.changeset.get_node(f_path)
 
            c.file_history = self._get_history(repo, c.files_list, f_path)
 

	
 
        except (RepositoryError, ChangesetError):
 
            c.files_list = None
 
            except RepositoryError, e:
 
                h.flash(str(e), category='warning')
 
                redirect(h.url('files_home', repo_name=repo_name, revision=revision))
 

	
 
        except RepositoryError, e:
 
            h.flash(str(e), category='warning')
 
            redirect(h.url('files_home', repo_name=repo_name, revision='tip'))
 

	
 

	
 

	
 
        return render('files/files.html')
 

	
rhodecode/templates/files/files.html
Show inline comments
 
@@ -11,7 +11,7 @@
 
    »
 
    ${_('files')}
 
    %if c.files_list:
 
        @ R${c.rev_nr}:${h.short_id(c.cur_rev)}
 
        @ r${c.changeset.revision}:${h.short_id(c.changeset.raw_id)}
 
    %endif        
 
</%def>
 

	
 
@@ -24,11 +24,18 @@
 
    <!-- box / title -->
 
    <div class="title">
 
        ${self.breadcrumbs()}     
 
	    <ul class="links">
 
		    <li>
 
		      <span style="text-transform: uppercase;"><a href="#">${_('branch')}: ${c.changeset.branch}</a></span>
 
	        </li>          
 
	    </ul>             
 
    </div>
 
    <div class="table">
 
		<div id="files_data">
 
			%if c.files_list:
 
				<h3 class="files_location">${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.cur_rev,c.files_list.path)}</h3>
 
				<h3 class="files_location">
 
				    ${_('Location')}: ${h.files_breadcrumbs(c.repo_name,c.changeset.raw_id,c.files_list.path)}
 
				</h3>
 
					%if c.files_list.is_dir():
 
						<%include file='files_browser.html'/>
 
					%else:
rhodecode/templates/files/files_browser.html
Show inline comments
 
@@ -10,9 +10,9 @@
 
		${h.form(h.url.current())}
 
		<div class="info_box">
 
          <span >${_('view')}@rev</span> 
 
          <a href="${c.url_prev}">&laquo;</a>
 
          ${h.text('at_rev',value=c.rev_nr,size=3)}
 
          <a href="${c.url_next}">&raquo;</a>
 
          <a href="${c.url_prev}" title="${_('previous revision')}">&laquo;</a>
 
          ${h.text('at_rev',value=c.changeset.revision,size=3)}
 
          <a href="${c.url_next}" title="${_('next revision')}">&raquo;</a>
 
          ${h.submit('view','view')}
 
	    </div>           
 
		${h.end_form()}
 
@@ -33,7 +33,7 @@
 
          		%if c.files_list.parent:
 
         		<tr class="parity0">
 
	          		<td>		          		
 
	          			${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.files_list.parent.path),class_="browser-dir")}
 
	          			${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.files_list.parent.path),class_="browser-dir")}
 
	          		</td>
 
	          		<td></td>
 
	          		<td></td>
 
@@ -46,7 +46,7 @@
 
		    %for cnt,node in enumerate(c.files_list,1):
 
				<tr class="parity${cnt%2}">
 
		             <td>
 
						${h.link_to(node.name,h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=node.path),class_=file_class(node))}
 
						${h.link_to(node.name,h.url('files_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=node.path),class_=file_class(node))}
 
		             </td>
 
		             <td>
 
		             %if node.is_file():
 
@@ -60,12 +60,12 @@
 
		             </td>
 
		             <td>
 
		             	%if node.is_file():
 
		             		${node.last_changeset.revision}
 
		             		<span class="tooltip" tooltip_title="${node.last_changeset.raw_id}">${node.last_changeset.revision}</span>
 
		             	%endif
 
		             </td>
 
		             <td>
 
		             	%if node.is_file():
 
		             		${h.age(node.last_changeset.date)} - ${node.last_changeset.date}
 
		             		${node.last_changeset.date} - ${h.age(node.last_changeset.date)} ${_('ago')} 
 
		             	%endif
 
		             </td>
 
		             <td>
rhodecode/templates/files/files_source.html
Show inline comments
 
@@ -10,11 +10,11 @@
 
	<dd>${c.files_list.mimetype}</dd>
 
	<dt>${_('Options')}</dt>
 
	<dd>${h.link_to(_('show annotation'),
 
			h.url('files_annotate_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
 
			h.url('files_annotate_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
 
		 / ${h.link_to(_('show as raw'),
 
			h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}			
 
			h.url('files_raw_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}			
 
		 / ${h.link_to(_('download as raw'),
 
			h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
 
			h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
 
	</dd>
 
	<dt>${_('History')}</dt>
 
	<dd>
 
@@ -40,7 +40,7 @@
 
			${h.pygmentize(c.files_list,linenos=True,anchorlinenos=True,lineanchors='S',cssclass="code-highlight")}
 
		%else:
 
			${_('File is to big to display')} ${h.link_to(_('show as raw'),
 
			h.url('files_raw_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.f_path))}
 
			h.url('files_raw_home',repo_name=c.repo_name,revision=c.changeset.raw_id,f_path=c.f_path))}
 
		%endif
 
	</div>
 
</div>
0 comments (0 inline, 0 general)