diff rhodecode/controllers/files.py @ 1190:0d7a127e6449 beta

use cs get history instead of node.history, node history have to much reference calls
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 31 Mar 2011 08:00:24 +0200
parents a4e1b955fe07
children 3ecaa17d9dea
line wrap: on
line diff
--- a/rhodecode/controllers/files.py	Wed Mar 30 12:59:49 2011 +0200
+++ b/rhodecode/controllers/files.py	Thu Mar 31 08:00:24 2011 +0200
@@ -135,8 +135,11 @@
         #files or dirs
         try:
             c.files_list = c.changeset.get_node(f_path)
-            c.file_history = self._get_history(c.rhodecode_repo,
-                                               c.files_list, f_path)
+
+            if c.files_list.is_file():
+                c.file_history = self._get_node_history(c.changeset, f_path)
+            else:
+                c.file_history = []
         except RepositoryError, e:
             h.flash(str(e), category='warning')
             redirect(h.url('files_home', repo_name=repo_name,
@@ -163,14 +166,11 @@
         return file_node.content
 
     def annotate(self, repo_name, revision, f_path):
-        cs = self.__get_cs_or_redirect(revision, repo_name)
-        c.file = self.__get_filenode_or_redirect(repo_name, cs, f_path)
+        c.cs = self.__get_cs_or_redirect(revision, repo_name)
+        c.file = self.__get_filenode_or_redirect(repo_name, c.cs, f_path)
 
-        c.file_history = self._get_history(c.rhodecode_repo,
-                                           c.file, f_path)
-        c.cs = cs
+        c.file_history = self._get_node_history(c.cs, f_path)
         c.f_path = f_path
-
         return render('files/files_annotate.html')
 
     def archivefile(self, repo_name, fname):
@@ -275,10 +275,8 @@
             c.no_changes = True
         return render('files/file_diff.html')
 
-    def _get_history(self, repo, node, f_path):
-        if not node.is_file():
-            return []
-        changesets = node.history
+    def _get_node_history(self, cs, f_path):
+        changesets = cs.get_file_history(f_path)
         hist_l = []
 
         changesets_group = ([], _("Changesets"))