comparison rhodecode/controllers/files.py @ 2929:f3b913b76be1 beta

Calculate file history always from latest changeset to always show full history. When doing the calculation from a particular changeset git doesn't any records from parent changesets
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 17 Oct 2012 20:32:25 +0200
parents 5899fe08f063
children a01c5994015c
comparison
equal deleted inserted replaced
2928:0ebdd15de1d8 2929:f3b913b76be1
151 # files or dirs 151 # files or dirs
152 try: 152 try:
153 c.file = c.changeset.get_node(f_path) 153 c.file = c.changeset.get_node(f_path)
154 154
155 if c.file.is_file(): 155 if c.file.is_file():
156 _hist = c.changeset.get_file_history(f_path) 156 _hist = c.rhodecode_repo.get_changeset().get_file_history(f_path)
157 c.file_history = self._get_node_history(c.changeset, f_path, 157 c.file_history = self._get_node_history(None, f_path, _hist)
158 _hist)
159 c.authors = [] 158 c.authors = []
160 for a in set([x.author for x in _hist]): 159 for a in set([x.author for x in _hist]):
161 c.authors.append((h.email(a), h.person(a))) 160 c.authors.append((h.email(a), h.person(a)))
162 else: 161 else:
163 c.authors = c.file_history = [] 162 c.authors = c.file_history = []
485 c.changes = [('', node2, diff, cs1, cs2, st,)] 484 c.changes = [('', node2, diff, cs1, cs2, st,)]
486 485
487 return render('files/file_diff.html') 486 return render('files/file_diff.html')
488 487
489 def _get_node_history(self, cs, f_path, changesets=None): 488 def _get_node_history(self, cs, f_path, changesets=None):
489 if cs is None:
490 # if we pass empty CS calculate history based on tip
491 cs = c.rhodecode_repo.get_changeset()
490 if changesets is None: 492 if changesets is None:
491 changesets = cs.get_file_history(f_path) 493 changesets = cs.get_file_history(f_path)
494
492 hist_l = [] 495 hist_l = []
493 496
494 changesets_group = ([], _("Changesets")) 497 changesets_group = ([], _("Changesets"))
495 branches_group = ([], _("Branches")) 498 branches_group = ([], _("Branches"))
496 tags_group = ([], _("Tags")) 499 tags_group = ([], _("Tags"))