mozreview: Autoland-in-progress message should include target branch (bug 1238166) r=mdoglio
authorDan Minor <dminor@mozilla.com>
Tue, 12 Jan 2016 08:13:10 -0500
changeset 362092 ef8435864f8c0aa53342fa5c82db161e539a416d
parent 362091 db4401543437ffdad6c4d7fe35af008f49b1b6b2
child 362093 2b1fc9fc244165bebde9be74889beeb9686c101d
push id16998
push userrwood@mozilla.com
push dateMon, 02 May 2016 19:42:03 +0000
reviewersmdoglio
bugs1238166
mozreview: Autoland-in-progress message should include target branch (bug 1238166) r=mdoglio This adds the branch name to the title for autoland messages. This also adds a line indicating who triggered the autoland request.
pylib/mozreview/mozreview/templates/mozreview/commits.html
pylib/mozreview/mozreview/templatetags/mozreview.py
--- a/pylib/mozreview/mozreview/templates/mozreview/commits.html
+++ b/pylib/mozreview/mozreview/templates/mozreview/commits.html
@@ -78,33 +78,39 @@ This is the template for the "Commits" l
       <div class="action-separator"></div>
       {% endif %}
 
       {% if autoland_request.last_known_status == 'P' %}
       <div class="action action-failure">
         <div class="action-icon rounded-icon"></div>
         <div class="action-info">
           <h4 class="action-heading">
-              There was an error executing the Autoland request.
+              There was an error executing the Autoland request on {{autoland_request.repository_url|mercurial_repo_name}}
           </h4>
+          <span class="action-meta">
+            Requested by {{autoland_request.user_id|userid_to_user}}
+          </span>
           <span class="action-meta" title="{{ autoland_request.last_error_msg|escape }}">
             {{ autoland_request.last_error_msg }}
           </span>
         </div>
       </div>
       {% endif %}
 
       {% if autoland_request.last_known_status == 'R' %}
       <div class="action action-requested">
         <div class="action-icon rounded-icon"></div>
         <div class="action-info">
           <h4 class="action-heading">
-            Waiting for the Autoland request to execute, hold tight
+            Waiting for the Autoland request to execute on {{autoland_request.repository_url|mercurial_repo_name}}, hold tight
           </h4>
           <span class="action-meta">
+            Requested by {{autoland_request.user_id|userid_to_user}}
+          </span>
+          <span class="action-meta">
             {% if autoland_request.last_details %}
             {{autoland_request.last_details}}
             {% else %}
             If the tree is closed autoland will retry your push for you until the tree opens.
             {% endif %}
           </span>
         </div>
       </div>
@@ -115,16 +121,19 @@ This is the template for the "Commits" l
         <div class="action-icon rounded-icon"></div>
         <div class="action-info">
           <a href="{{autoland_request.repository_url|ssh_to_https}}/rev/{{autoland_request.repository_revision}}">
             See it in Mercurial
           </a>
           <h4 class="action-heading">
             Commit(s) successfully landed on {{autoland_request.repository_url|mercurial_repo_name}}
           </h4>
+          <span class="action-meta">
+            Requested by {{autoland_request.user_id|userid_to_user}}
+          </span>
         </div>
       </div>
         {% if autoland_request.repository_url|treeherder_repo %}
         <div class="action-separator"></div>
         <div class="action action-landed"
              data-repository="{{autoland_request.repository_url|treeherder_repo}}"
              data-revision="{{autoland_request.repository_revision}}">
           <div class="action-icon rounded-icon"></div>
--- a/pylib/mozreview/mozreview/templatetags/mozreview.py
+++ b/pylib/mozreview/mozreview/templatetags/mozreview.py
@@ -1,11 +1,12 @@
 import logging
 
 from django import template
+from django.contrib.auth.models import User
 
 register = template.Library()
 
 
 @register.filter()
 def isSquashed(aReviewRequest):
     return str(aReviewRequest.extra_data.get('p2rb.is_squashed', 'False')).lower() == 'true'
 
@@ -71,8 +72,15 @@ def treeherder_repo(landing_url):
 @register.filter()
 def mercurial_repo_name(landing_url):
     return landing_url.rstrip('/').split('/')[-1]
 
 
 @register.filter()
 def ssh_to_https(landing_url):
     return landing_url.rstrip('/').replace('ssh://', 'https://')
+
+@register.filter()
+def userid_to_user(user_id):
+    try:
+        return User.objects.get(pk=user_id)
+    except User.DoesNotExist:
+        return 'Unknown user'