diff pylons_app/controllers/files.py @ 128:9deb6f1d5b90

Implemented file history.
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 03 May 2010 21:59:01 +0200
parents a86c8de926b4
children 42d46deb124d
line wrap: on
line diff
--- a/pylons_app/controllers/files.py	Mon May 03 19:07:54 2010 +0200
+++ b/pylons_app/controllers/files.py	Mon May 03 21:59:01 2010 +0200
@@ -22,4 +22,18 @@
         
         c.files_list = c.changeset.get_node(f_path)
         
-        return render('/files.html')
+        c.file_history = self._get_history(repo, c.files_list, f_path)
+        return render('files/files.html')
+
+
+    def _get_history(self, repo, node, f_path):
+        from vcs.nodes import NodeKind
+        if not node.kind is NodeKind.FILE:
+            return []
+        changesets = list(node.history)
+        changesets.reverse()
+        hist_l = []
+        for chs in changesets:
+            n_desc = 'r%s:%s' % (chs.revision, chs._short)
+            hist_l.append((chs._short, n_desc,))
+        return hist_l