Changeset - cdb2b5ac95e6
[Not reviewed]
default
0 1 0
Mads Kiilerich - 12 years ago 2013-12-10 19:30:37
madski@unity3d.com
pull requests: work around expensive hidden scm_instance property getter for get_changeset in hot spots
1 file changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/pullrequests.py
Show inline comments
 
@@ -197,7 +197,8 @@ class PullrequestsController(BaseRepoCon
 
         c.other_ref_name,
 
         c.other_rev) = pull_request.other_ref.split(':')
 

	
 
        c.cs_ranges = [c.org_repo.get_changeset(x) for x in pull_request.revisions]
 
        org_scm_instance = c.org_repo.scm_instance # property with expensive cache invalidation check!!!
 
        c.cs_ranges = [org_scm_instance.get_changeset(x) for x in pull_request.revisions]
 
        c.cs_ranges_org = None # not stored and not important and moving target - could be calculated ...
 

	
 
        c.statuses = c.org_repo.statuses([x.raw_id for x in c.cs_ranges])
 
@@ -211,8 +212,8 @@ class PullrequestsController(BaseRepoCon
 

	
 
        # we swap org/other ref since we run a simple diff on one repo
 
        log.debug('running diff between %s and %s in %s'
 
                  % (c.other_rev, c.org_rev, c.org_repo.scm_instance.path))
 
        txtdiff = c.org_repo.scm_instance.get_diff(rev1=safe_str(c.other_rev), rev2=safe_str(c.org_rev),
 
                  % (c.other_rev, c.org_rev, org_scm_instance.path))
 
        txtdiff = org_scm_instance.get_diff(rev1=safe_str(c.other_rev), rev2=safe_str(c.org_rev),
 
                                      ignore_whitespace=ignore_whitespace,
 
                                      context=line_context)
 

	
0 comments (0 inline, 0 general)