1. mikespook
  2. RhodeCode

Commits

Marcin Kuzminski  committed c47152c

added tags, and branches to file history select box, fixed annotation changeset errors crash on wrongly given revions

  • Participants
  • Parent commits 8767769
  • Branches beta

Comments (0)

Files changed (1)

File rhodecode/controllers/files.py

View file
             try:
                 c.files_list = c.changeset.get_node(f_path)
                 c.file_history = self._get_history(c.repo, c.files_list, f_path)
-
             except RepositoryError, e:
                 h.flash(str(e), category='warning')
                 redirect(h.url('files_home', repo_name=repo_name, revision=revision))
     def annotate(self, repo_name, revision, f_path):
         hg_model = ScmModel()
         c.repo = hg_model.get_repo(c.repo_name)
-        c.cs = c.repo.get_changeset(revision)
-        c.file = c.cs.get_node(f_path)
+
+        try:
+            c.cs = c.repo.get_changeset(revision)
+            c.file = c.cs.get_node(f_path)
+        except RepositoryError, e:
+            h.flash(str(e), category='warning')
+            redirect(h.url('files_home', repo_name=repo_name, revision=revision))
+
         c.file_history = self._get_history(c.repo, c.file, f_path)
 
         c.f_path = f_path
             return []
         changesets = node.history
         hist_l = []
+
+        changesets_group = ([], _("Changesets"))
+        branches_group = ([], _("Branches"))
+        tags_group = ([], _("Tags"))
+
         for chs in changesets:
             n_desc = 'r%s:%s' % (chs.revision, chs.short_id)
-            hist_l.append((chs.raw_id, n_desc,))
+            changesets_group[0].append((chs.raw_id, n_desc,))
+
+        hist_l.append(changesets_group)
+
+        for name, chs in c.repository_branches.items():
+            #chs = chs.split(':')[-1]
+            branches_group[0].append((chs, name),)
+        hist_l.append(branches_group)
+
+        for name, chs in c.repository_tags.items():
+            #chs = chs.split(':')[-1]
+            tags_group[0].append((chs, name),)
+        hist_l.append(tags_group)
+
         return hist_l
+
+#                [
+#                 ([("u1", "User1"), ("u2", "User2")], "Users"),
+#                 ([("g1", "Group1"), ("g2", "Group2")], "Groups")
+#                 ]
+