# HG changeset patch # User Mads Kiilerich # Date 1406917722 -7200 # Node ID f5e3e703b186ca5f9433704f216eead38ee56341 # Parent b5d079b76f72aa100141967d764bb9f6082dc51d pull requests: more helpful messages for PR update candidates and what is going on on the branch diff -r b5d079b76f72 -r f5e3e703b186 kallithea/controllers/pullrequests.py --- a/kallithea/controllers/pullrequests.py Thu Jul 24 12:29:08 2014 +0200 +++ b/kallithea/controllers/pullrequests.py Fri Aug 01 20:28:42 2014 +0200 @@ -226,12 +226,24 @@ # 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 - if other_scm_instance._repo.revs('%s&::%s', revs[0], other_branch_name): - pass + if other_scm_instance._repo.revs('present(%s)::&%s', c.cs_ranges[-1].raw_id, other_branch_name): + c.update_msg = _('This pull request has already been merged to %s.') % other_branch_name else: # look for children of PR head on source branch in org repo arevs = org_scm_instance._repo.revs('%s:: & branch(%s) - %s', revs[0], c.org_branch_name, revs[0]) - c.available = [org_scm_instance.get_changeset(x) for x in arevs] + if arevs: + if c.pull_request.is_closed(): + c.update_msg = _('This pull request has been closed and can not be updated with descendent changes on %s:') % c.org_branch_name + else: + c.update_msg = _('This pull request can be updated with descendent changes on %s:') % c.org_branch_name + c.available = [org_scm_instance.get_changeset(x) for x in arevs] + else: + c.update_msg = _('No changesets found for updating this pull request.') + + if org_scm_instance._repo.revs('head() & not (%s::) & branch(%s)', revs[0], c.org_branch_name): + c.update_msg_other = _('Note: Branch %s also contains unrelated changes.') % c.org_branch_name + else: + c.update_msg_other = _('Branch %s does not contain other changes.') % c.org_branch_name raw_ids = [x.raw_id for x in c.cs_ranges] c.cs_comments = c.org_repo.get_comments(raw_ids) diff -r b5d079b76f72 -r f5e3e703b186 kallithea/public/css/style.css --- a/kallithea/public/css/style.css Thu Jul 24 12:29:08 2014 +0200 +++ b/kallithea/public/css/style.css Fri Aug 01 20:28:42 2014 +0200 @@ -4829,6 +4829,10 @@ margin: 5px; } +#pr-summary .msg-div { + margin: 5px 0; +} + /**** PERMS *****/ diff -r b5d079b76f72 -r f5e3e703b186 kallithea/templates/pullrequests/pullrequest_show.html --- a/kallithea/templates/pullrequests/pullrequest_show.html Thu Jul 24 12:29:08 2014 +0200 +++ b/kallithea/templates/pullrequests/pullrequest_show.html Fri Aug 01 20:28:42 2014 +0200 @@ -177,9 +177,10 @@
- %if c.available: -
- ${_("Changesets on %s not included in this pull request:") % c.org_branch_name} +
+
${c.update_msg}
+ %if c.available: +
%for cnt, cs in enumerate(reversed(c.available)): @@ -190,13 +191,13 @@ %endfor
+ %endif +
${c.update_msg_other}
+
+ %if c.available:
${h.submit('copy_update',_('Create pull request update'),class_="btn btn-small")}
- %else: -
- ${_("No changesets found for updating this pull request.")} -
%endif
${h.end_form()}