Bug 1462108 [wpt PR 11036] - Prevent GitTree logging errors if git fails., a=testonly
authorJames Graham <james@hoppipolla.co.uk>
Sat, 19 May 2018 20:38:08 +0000
changeset 419086 3f948b66292b54df4972b90ca78c5cc30e25b03a
parent 419085 6d59c2e00ab1554c91cd700eedf09266e0d6d688
child 419087 e63d00cb2e5d0f003ab590db7b5e6979dec68ce6
push id34026
push userapavel@mozilla.com
push dateMon, 21 May 2018 09:47:33 +0000
treeherdermozilla-central@dc1868d255be [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1462108, 11036
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1462108 [wpt PR 11036] - Prevent GitTree logging errors if git fails., a=testonly Automatic update from web-platform-testsPrevent GitTree logging errors if git fails. The errors logged when failing to get a git revision cause issues in the gecko infrastructure. Fix this by passing throught the log_error=False flag to suppress printing the error. -- wpt-commits: a0bd72dbb7db5f71add0d20ac0d9e2d20270700b wpt-pr: 11036
testing/web-platform/tests/tools/wptrunner/wptrunner/update/tree.py
testing/web-platform/tests/tools/wptrunner/wptrunner/vcs.py
testing/web-platform/tests/tools/wptrunner/wptrunner/wpttest.py
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/update/tree.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/update/tree.py
@@ -126,21 +126,21 @@ class HgTree(object):
             return True
         except subprocess.CalledProcessError:
             return False
 
 
 class GitTree(object):
     name = "git"
 
-    def __init__(self, root=None):
+    def __init__(self, root=None, log_error=True):
         if root is None:
-            root = git("rev-parse", "--show-toplevel").strip()
+            root = git("rev-parse", "--show-toplevel", log_error=log_error).strip()
         self.root = root
-        self.git = vcs.bind_to_repo(git, self.root)
+        self.git = vcs.bind_to_repo(git, self.root, log_error=log_error)
         self.message = None
         self.commit_cls = Commit
 
     def __getstate__(self):
         rv = self.__dict__.copy()
         del rv['git']
         return rv
 
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/vcs.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/vcs.py
@@ -32,18 +32,18 @@ def vcs(bin_name):
                 logger.error(e.output)
             raise
     return inner
 
 git = vcs("git")
 hg = vcs("hg")
 
 
-def bind_to_repo(vcs_func, repo):
-    return partial(vcs_func, repo=repo)
+def bind_to_repo(vcs_func, repo, log_error=True):
+    return partial(vcs_func, repo=repo, log_error=log_error)
 
 
-def is_git_root(path):
+def is_git_root(path, log_error=True):
     try:
-        rv = git("rev-parse", "--show-cdup", repo=path)
+        rv = git("rev-parse", "--show-cdup", repo=path, log_error=log_error)
     except subprocess.CalledProcessError:
         return False
     return rv == "\n"
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/wpttest.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/wpttest.py
@@ -69,17 +69,17 @@ class RunInfo(dict):
     def __init__(self, metadata_root, product, debug, browser_version=None, extras=None):
         import mozinfo
         self._update_mozinfo(metadata_root)
         self.update(mozinfo.info)
 
         from update.tree import GitTree
         try:
             # GitTree.__init__ throws if we are not in a git tree.
-            rev = GitTree().rev
+            rev = GitTree(log_error=False).rev
         except subprocess.CalledProcessError:
             rev = None
         if rev:
             self["revision"] = rev
 
         self["product"] = product
         if debug is not None:
             self["debug"] = debug