changeset 2981:6cd0f8f8aef1 beta

Let the function calculating changeset history do all the work - fixed exception handling for fallback method
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 04 Nov 2012 14:34:34 +0100
parents 234435584a0d
children 78227b65a358
files rhodecode/controllers/files.py
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/files.py	Sun Nov 04 13:43:21 2012 +0100
+++ b/rhodecode/controllers/files.py	Sun Nov 04 14:34:34 2012 +0100
@@ -46,7 +46,7 @@
 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
@@ -155,14 +155,12 @@
             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)))
@@ -519,7 +517,7 @@
         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)
 
@@ -544,7 +542,7 @@
             tags_group[0].append((chs, name),)
         hist_l.append(tags_group)
 
-        return hist_l
+        return hist_l, changesets
 
     @LoginRequired()
     @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',