# HG changeset patch # User Marcin Kuzminski # Date 1352030907 -3600 # Node ID cff9d4e1d82162961d6cabd72756940a21c29544 # Parent 45a8e0051280bb4cd3ce2f91b47c2b7f30454677 Fixed issue when node didn't exists at 'tip' and we tried calculate history based on that assumption. Now fallback to the changeset the node exists in for history calculation diff -r 45a8e0051280 -r cff9d4e1d821 rhodecode/controllers/files.py --- a/rhodecode/controllers/files.py Tue Oct 30 20:56:04 2012 +0100 +++ b/rhodecode/controllers/files.py Sun Nov 04 13:08:27 2012 +0100 @@ -45,7 +45,8 @@ from rhodecode.lib.vcs.conf import settings from rhodecode.lib.vcs.exceptions import RepositoryError, \ ChangesetDoesNotExistError, EmptyRepositoryError, \ - ImproperArchiveTypeError, VCSError, NodeAlreadyExistsError + ImproperArchiveTypeError, VCSError, NodeAlreadyExistsError,\ + NodeDoesNotExistError from rhodecode.lib.vcs.nodes import FileNode from rhodecode.model.repo import RepoModel @@ -160,7 +161,8 @@ c.file_changeset = (c.changeset if c.changeset.revision < _hist[0].revision else _hist[0]) - c.file_history = self._get_node_history(None, f_path, _hist) + 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))) @@ -504,11 +506,22 @@ return render('files/file_diff.html') def _get_node_history(self, cs, f_path, changesets=None): - if cs is None: - # if we pass empty CS calculate history based on tip - cs = c.rhodecode_repo.get_changeset() + """ + get changesets history for given node + + :param cs: changeset to calculate history + :param f_path: path for node to calculate history for + :param changesets: if passed don't calculate history and take + changesets defined in this list + """ + # calculate history based on tip + tip_cs = c.rhodecode_repo.get_changeset() if changesets is None: - changesets = cs.get_file_history(f_path) + try: + changesets = tip_cs.get_file_history(f_path) + except NodeDoesNotExistError: + #this node is not present at tip ! + changesets = cs.get_file_history(f_path) hist_l = [] diff -r 45a8e0051280 -r cff9d4e1d821 rhodecode/templates/files/files.html --- a/rhodecode/templates/files/files.html Tue Oct 30 20:56:04 2012 +0100 +++ b/rhodecode/templates/files/files.html Sun Nov 04 13:08:27 2012 +0100 @@ -80,7 +80,7 @@ History.pushState(data, title, url); //now we're sure that we can do ypjax things - YUE.preventDefault(e) + YUE.preventDefault(e); return false; }); }