Mercurial > kallithea
changeset 4409:f5e3e703b186
pull requests: more helpful messages for PR update candidates and what is going on on the branch
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Fri, 01 Aug 2014 20:28:42 +0200 |
parents | b5d079b76f72 |
children | a1aa34845e94 |
files | kallithea/controllers/pullrequests.py kallithea/public/css/style.css kallithea/templates/pullrequests/pullrequest_show.html |
diffstat | 3 files changed, 27 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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 *****/
--- 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 @@ <div class="label-summary"> <label>${_('Update')}:</label> </div> - %if c.available: - <div class="input" style="max-height:200px; overflow-y:auto; overflow-x:hidden"> - ${_("Changesets on %s not included in this pull request:") % c.org_branch_name} + <div class="input"> + <div class="msg-div">${c.update_msg}</div> + %if c.available: + <div style="max-height:200px; overflow-y:auto; overflow-x:hidden; margin-bottom: 10px"> <table class="noborder"> %for cnt, cs in enumerate(reversed(c.available)): <tr> @@ -190,13 +191,13 @@ %endfor </table> </div> + %endif + <div class="msg-div">${c.update_msg_other}</div> + </div> + %if c.available: <div class="buttons"> ${h.submit('copy_update',_('Create pull request update'),class_="btn btn-small")} </div> - %else: - <div class="input"> - ${_("No changesets found for updating this pull request.")} - </div> %endif </div> ${h.end_form()}