# HG changeset patch # User Marcin Kuzminski # Date 2012-06-11 21:10:34 # Node ID b45e9fd75ac001e17d3b489e1d191531296e3709 # Parent fd0a822481ecd4330890e46c2be8a41fd0b6c8f7 data checks diff --git a/rhodecode/controllers/compare.py b/rhodecode/controllers/compare.py --- a/rhodecode/controllers/compare.py +++ b/rhodecode/controllers/compare.py @@ -68,6 +68,10 @@ class CompareController(BaseRepoControll log.error('Could not found repo %s or %s' % (org_repo, other_repo)) raise HTTPNotFound + if c.org_repo.scm_instance.alias != 'hg': + log.error('Review not available for GIT REPOS') + raise HTTPNotFound + c.cs_ranges, discovery_data = PullRequestModel().get_compare_data( org_repo, org_ref, other_repo, other_ref ) diff --git a/rhodecode/controllers/pullrequests.py b/rhodecode/controllers/pullrequests.py --- a/rhodecode/controllers/pullrequests.py +++ b/rhodecode/controllers/pullrequests.py @@ -78,6 +78,11 @@ class PullrequestsController(BaseRepoCon def index(self): org_repo = c.rhodecode_db_repo + + if org_repo.scm_instance.alias != 'hg': + log.error('Review not available for GIT REPOS') + raise HTTPNotFound + c.org_refs = self._get_repo_refs(c.rhodecode_repo) c.org_repos = [] c.other_repos = [] @@ -101,7 +106,6 @@ class PullrequestsController(BaseRepoCon org_repo.parent.repo_name)) ) - #TODO: maybe the owner should be default ? c.review_members = [] c.available_members = [] for u in User.query().filter(User.username != 'default').all(): @@ -192,6 +196,15 @@ class PullrequestsController(BaseRepoCon c.users_groups_array = repo_model.get_users_groups_js() c.pull_request = PullRequest.get(pull_request_id) + # valid ID + if not c.pull_request: + raise HTTPNotFound + + # pull_requests repo_name we opened it against + # ie. other_repo must match + if repo_name != c.pull_request.other_repo.repo_name: + raise HTTPNotFound + # load compare data into template context self._load_compare_data(c.pull_request) @@ -261,4 +274,4 @@ class PullrequestsController(BaseRepoCon data.update({'rendered_text': render('changeset/changeset_comment_block.html')}) - return data \ No newline at end of file + return data