diff rhodecode/controllers/files.py @ 2456:51b203e44202 beta

Add authors into file view
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 14 Jun 2012 11:48:51 +0200
parents 530bd12fc18a
children 01e005cabd4d
line wrap: on
line diff
--- a/rhodecode/controllers/files.py	Thu Jun 14 02:41:05 2012 +0200
+++ b/rhodecode/controllers/files.py	Thu Jun 14 11:48:51 2012 +0200
@@ -154,9 +154,14 @@
             c.file = c.changeset.get_node(f_path)
 
             if c.file.is_file():
-                c.file_history = self._get_node_history(c.changeset, f_path)
+                _hist = c.changeset.get_file_history(f_path)
+                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.file_history = []
+                c.authors = c.file_history = []
         except RepositoryError, e:
             h.flash(str(e), category='warning')
             redirect(h.url('files_home', repo_name=repo_name,
@@ -454,8 +459,9 @@
 
         return render('files/file_diff.html')
 
-    def _get_node_history(self, cs, f_path):
-        changesets = cs.get_file_history(f_path)
+    def _get_node_history(self, cs, f_path, changesets=None):
+        if changesets is None:
+            changesets = cs.get_file_history(f_path)
         hist_l = []
 
         changesets_group = ([], _("Changesets"))