mozreview: [WIP] Change Status column to Cleared for Landing (bug 1245577); r?mdoglio draft
authorMike Conley <mconley@mozilla.com>
Sun, 20 Mar 2016 05:39:06 -0400
changeset 7535 28f51555e0e69d00cab10c42101c0b921ec9938e
parent 7534 f7ac1a434493f08584b0bef38c8fd0799128531e
push id707
push usermconley@mozilla.com
push dateSun, 20 Mar 2016 10:14:02 +0000
reviewersmdoglio
bugs1245577
mozreview: [WIP] Change Status column to Cleared for Landing (bug 1245577); r?mdoglio MozReview-Commit-ID: DxvdA3AFEkL
pylib/mozreview/mozreview/hooks.py
pylib/mozreview/mozreview/templates/mozreview/commits.html
--- a/pylib/mozreview/mozreview/hooks.py
+++ b/pylib/mozreview/mozreview/hooks.py
@@ -93,16 +93,30 @@ class MozReviewApprovalHook(ReviewReques
     def is_approved_child(self, review_request):
         """Check approval for a child review request"""
         if review_request.shipit_count == 0:
             return False, 'A suitable reviewer has not given a "Ship It!"'
 
         if review_request.issue_open_count > 0:
             return False, 'The review request has open issues.'
 
+        # If there have been resolved issues since the last revision
+        # was posted, we're waiting on a new revision.
+
+        # See if there were any issues marked "fixed" for the latest
+        # DiffSet history object.
+        # get_latest_diffset is the most recent FileDiff, so get all comments
+        # for all FileDiffs in that DiffSet. (get_latest_diffset.files)
+        # Also, don't forget interdiffs!
+        # Comment.objects.filter(filediff__in=diffset.filediffs.all())
+        # Comment.objects.filter(issue_status=Comment.RESOLVED & (Q(filediff__in=diffset.filediffs.all()) | Q(interfilediff__in=diffset.filediffs.all())))
+        if foo_bar_baz:
+            return False, 'Issues have been fixed since the last revision.'
+                          'A new revision needs to be uploaded.'
+
         # TODO: Add a check that we have executed a try build of some kind.
 
         author_mrp = get_profile(review_request.submitter)
 
         # TODO: Make these "has_..." methods return the set of reviews
         # which match the criteria so we can indicate which reviews
         # actually gave the permission to land.
         if author_mrp.has_scm_ldap_group('scm_level_3'):
--- a/pylib/mozreview/mozreview/templates/mozreview/commits.html
+++ b/pylib/mozreview/mozreview/templates/mozreview/commits.html
@@ -24,17 +24,17 @@ This is the template for the "Commits" l
     <tr>
       <th class="hg">{% trans "Hg" %}</th>
       <th class="diff">{% trans "Diff" %}</th>
       <th class="reviews">{% trans "Reviews" %}</th>
       {% comment "TODO: show this column when the commit author will be available" %}
       <th class="submitter">{% trans "Submitter" %}</th>
       {% endcomment %}
       <th class="reviewers">{% trans "Reviewers" %}</th>
-      <th class="status">{% trans "Status" %}</th>
+      <th class="status">{% trans "Cleared for Landing" %}</th>
     </tr>
     </thead>
     {% for child_details in children_details %}
     <tr {% if child_details.get_review_request.id = review_request_details.get_review_request.id %}current="true"{% endif %}>
       <td class="hg">
         <a href="{{child_details.get_review_request.repository.path}}/rev/{{child_details|commit_id|slice:":12"}}">
           <div class="rb-icon rb-icon-jump-to"></div>
         </a>
@@ -63,17 +63,17 @@ This is the template for the "Commits" l
         </span>
       </td>
       <td class="status">
         {% if child_details.get_review_request.issue_open_count > 0 %}
         <a class="issue-count" href="{{child_details.get_review_request.get_absolute_url}}#issue-summary" title="{{child_details.get_review_request.issue_open_count}} open issues">
           <span class="issue-icon">!</span>{{child_details.get_review_request.issue_open_count}}
         </a>
         {% elif child_details.get_review_request.approved %}
-        <div class="approval" title="Approved For Landing - You have at least one valid ship it!">r+</div>
+        <div class="approval" title="You have at least one valid ship it, so land when ready!">r+</div>
         {% else %}
         <div class="no-approval" title="{{child_details.get_review_request.approval_failure}}">r?</div>
         {% endif %}
       </td>
     </tr>
     {% endfor %}
   </table>
   {% if latest_autoland_requests %}