changeset 6322:02d6a5b63331

pullrequests: avoid redundant database lookup
author Søren Løvborg <sorenl@unity3d.com>
date Thu, 27 Oct 2016 18:35:13 +0200
parents 78a4bbc24b42
children 533ec10dfd59
files kallithea/controllers/pullrequests.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/pullrequests.py	Thu Oct 27 18:37:14 2016 +0200
+++ b/kallithea/controllers/pullrequests.py	Thu Oct 27 18:35:13 2016 +0200
@@ -400,11 +400,11 @@
         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)