Changeset - 6cd0f8f8aef1
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 13 years ago 2012-11-04 14:34:34
marcin@python-works.com
Let the function calculating changeset history do all the work
- fixed exception handling for fallback method
1 file changed with 4 insertions and 6 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/files.py
Show inline comments
 
@@ -43,13 +43,13 @@ from rhodecode.lib.auth import LoginRequ
 
from rhodecode.lib.base import BaseRepoController, render
 
from rhodecode.lib.vcs.backends.base import EmptyChangeset
 
from rhodecode.lib.vcs.conf import settings
 
from rhodecode.lib.vcs.exceptions import RepositoryError, \
 
    ChangesetDoesNotExistError, EmptyRepositoryError, \
 
    ImproperArchiveTypeError, VCSError, NodeAlreadyExistsError,\
 
    NodeDoesNotExistError
 
    NodeDoesNotExistError, ChangesetError
 
from rhodecode.lib.vcs.nodes import FileNode
 

	
 
from rhodecode.model.repo import RepoModel
 
from rhodecode.model.scm import ScmModel
 
from rhodecode.model.db import Repository
 

	
 
@@ -152,20 +152,18 @@ class FilesController(BaseRepoController
 

	
 
        # files or dirs
 
        try:
 
            c.file = c.changeset.get_node(f_path)
 

	
 
            if c.file.is_file():
 
                _hist = c.rhodecode_repo.get_changeset().get_file_history(f_path)
 
                c.file_history, _hist = self._get_node_history(c.changeset, f_path)
 
                c.file_changeset = c.changeset
 
                if _hist:
 
                    c.file_changeset = (c.changeset
 
                                        if c.changeset.revision < _hist[0].revision
 
                                        else _hist[0])
 
                c.file_history = self._get_node_history(c.changeset, f_path,
 
                                                        _hist)
 
                c.authors = []
 
                for a in set([x.author for x in _hist]):
 
                    c.authors.append((h.email(a), h.person(a)))
 
            else:
 
                c.authors = c.file_history = []
 
        except RepositoryError, e:
 
@@ -516,13 +514,13 @@ class FilesController(BaseRepoController
 
        """
 
        # calculate history based on tip
 
        tip_cs = c.rhodecode_repo.get_changeset()
 
        if changesets is None:
 
            try:
 
                changesets = tip_cs.get_file_history(f_path)
 
            except NodeDoesNotExistError:
 
            except (NodeDoesNotExistError, ChangesetError):
 
                #this node is not present at tip !
 
                changesets = cs.get_file_history(f_path)
 

	
 
        hist_l = []
 

	
 
        changesets_group = ([], _("Changesets"))
 
@@ -541,13 +539,13 @@ class FilesController(BaseRepoController
 
        hist_l.append(branches_group)
 

	
 
        for name, chs in c.rhodecode_repo.tags.items():
 
            tags_group[0].append((chs, name),)
 
        hist_l.append(tags_group)
 

	
 
        return hist_l
 
        return hist_l, changesets
 

	
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    @jsonify
 
    def nodelist(self, repo_name, revision, f_path):
0 comments (0 inline, 0 general)