autoland: make treestatus handle full tree urls properly (bug 1243365) r?glob draft
authorDan Minor <dminor@mozilla.com>
Wed, 27 Jan 2016 09:32:38 -0500
changeset 6979 6cf52de55c6b72c2f150c2e2c7ca8ccf3243e299
parent 6974 7fed7c2123e19f596c8440c12820cca11098dc51
child 6980 a96773d9fde93713145ea874d1d3fbb332c46f2a
child 6981 332835da84bd7b9fc195ecfeb5716426032e4105
push id567
push userdminor@mozilla.com
push dateWed, 27 Jan 2016 15:12:12 +0000
reviewersglob
bugs1243365
autoland: make treestatus handle full tree urls properly (bug 1243365) r?glob We check for full integration branch urls and map them just to the short tree name for use with treestatus.
autoland/autoland/treestatus.py
--- a/autoland/autoland/treestatus.py
+++ b/autoland/autoland/treestatus.py
@@ -1,19 +1,25 @@
 import config
+import re
 import requests
 
 TREESTATUS_URL = 'https://treestatus.mozilla.org/'
 
 
 def tree_is_open(tree):
     treestatus_url = TREESTATUS_URL
     if config.testing():
         treestatus_url = 'http://treestatus/'
 
+    # Map integration branches to their short form name
+    m = re.match('ssh://hg\.mozilla\.org/integration/([^/]+)', tree)
+    if m and m.groups():
+        tree = m.groups()[0]
+
     try:
         r = requests.get(treestatus_url + tree + '?format=json', verify=False)
         if r.status_code == 200:
             return r.json()['status'] == 'open'
         elif r.status_code == 404:
             # We assume unrecognized trees are open
             return True
     except (KeyError, requests.exceptions.ConnectionError):