# HG changeset patch # User Marcin Kuzminski # Date 2017-10-06 13:44:17 # Node ID 824233025181103604ed113402f886b9a358500a # Parent cae7e0e276ca845b9cd6babef0e16e5702f407ec commits: add protection against 500 errors on commit children/parents page. diff --git a/rhodecode/apps/repository/views/repo_commits.py b/rhodecode/apps/repository/views/repo_commits.py --- a/rhodecode/apps/repository/views/repo_commits.py +++ b/rhodecode/apps/repository/views/repo_commits.py @@ -535,8 +535,13 @@ class RepoCommitsView(RepoAppView): commit_id = self.request.matchdict['commit_id'] self.load_default_context() - commit = self.rhodecode_vcs_repo.get_commit(commit_id=commit_id) - result = {"results": commit.children} + try: + commit = self.rhodecode_vcs_repo.get_commit(commit_id=commit_id) + children = commit.children + except CommitDoesNotExistError: + children = [] + + result = {"results": children} return result @LoginRequired() @@ -549,6 +554,10 @@ class RepoCommitsView(RepoAppView): commit_id = self.request.matchdict['commit_id'] self.load_default_context() - commit = self.rhodecode_vcs_repo.get_commit(commit_id=commit_id) - result = {"results": commit.parents} + try: + commit = self.rhodecode_vcs_repo.get_commit(commit_id=commit_id) + parents = commit.parents + except CommitDoesNotExistError: + parents = [] + result = {"results": parents} return result