# HG changeset patch # User Mads Kiilerich # Date 2015-01-06 00:54:36 # Node ID ded49765b47a80220bee018c5839691e105cf271 # Parent 1cd9bdf1362d7f7bf8d243963a496ebbf7ff9cc3 pullrequests: drop expensive listing of unrelated changesets that cannot be used for update It rarely gave any relevant info and could take several seconds to compute. Instead, just warn if the branch name has another head. Loading a pullrequest page on a slow repo did in one setup go from 7 s to 3.5 s. diff --git a/kallithea/controllers/pullrequests.py b/kallithea/controllers/pullrequests.py --- a/kallithea/controllers/pullrequests.py +++ b/kallithea/controllers/pullrequests.py @@ -584,6 +584,7 @@ class PullrequestsController(BaseRepoCon c.a_branch_name = other_scm_instance.get_changeset(c.a_ref_name).branch # use ref_type ? except EmptyRepositoryError: c.a_branch_name = 'null' # not a branch name ... but close enough + arevs = [] # candidates: descendants of old head that are on the right branch # and not are the old head itself ... # and nothing at all if old head is a descendent of target ref name @@ -601,12 +602,11 @@ class PullrequestsController(BaseRepoCon else: c.update_msg = _('No changesets found for updating this pull request.') - revs = org_scm_instance._repo.revs('head() & not (%s::) & branch(%s) & !closed()', revs[0], c.cs_branch_name) - if revs: - c.update_msg_other = _('Note: Branch %s also contains unrelated changes, such as %s.') % (c.cs_branch_name, - h.short_id(org_scm_instance.get_changeset((max(revs))).raw_id)) - else: - c.update_msg_other = _('Branch %s does not contain other changes.') % c.cs_branch_name + brevs = org_scm_instance._repo.revs('%s - %d - %ld', c.cs_branch_name, revs[0], arevs) + if brevs: + c.update_msg_other = _('Note: Branch %s has another head: %s.') % (c.cs_branch_name, + h.short_id(org_scm_instance.get_changeset((max(brevs))).raw_id)) + elif org_scm_instance.alias == 'git': c.update_msg = _("Git pull requests don't support updates yet.")