# HG changeset patch # User Søren Løvborg # Date 2016-10-27 18:35:13 # Node ID 02d6a5b63331a078787fe7c2d9b93a27949da309 # Parent 78a4bbc24b424b7da78bcb62c814c5108e35f0d0 pullrequests: avoid redundant database lookup diff --git a/kallithea/controllers/pullrequests.py b/kallithea/controllers/pullrequests.py --- a/kallithea/controllers/pullrequests.py +++ b/kallithea/controllers/pullrequests.py @@ -400,11 +400,11 @@ class PullrequestsController(BaseRepoCon raise HTTPFound(location=pull_request.url()) def create_new_iteration(self, old_pull_request, new_rev, title, description, reviewer_ids): - org_repo = RepoModel()._get_repo(old_pull_request.org_repo.repo_name) + org_repo = old_pull_request.org_repo org_ref_type, org_ref_name, org_rev = old_pull_request.org_ref.split(':') new_org_rev = self._get_ref_rev(org_repo, 'rev', new_rev) - other_repo = RepoModel()._get_repo(old_pull_request.other_repo.repo_name) + other_repo = old_pull_request.other_repo other_ref_type, other_ref_name, other_rev = old_pull_request.other_ref.split(':') # other_rev is ancestor #assert other_ref_type == 'branch', other_ref_type # TODO: what if not? new_other_rev = self._get_ref_rev(other_repo, other_ref_type, other_ref_name)