Bug 1300779 - [mozlint] Redirect stderr when detecting version control root, r?smacleod draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 06 Sep 2016 10:36:45 -0400
changeset 410262 944adc02a13080582dff902a1274a0d73f7f312f
parent 410066 8c9c4e816e86f903c1d820f3f29715dc070a5a4a
child 530548 b8f5d32e3644e574a15da4bb5166bbc0499b3efe
push id28704
push userahalberstadt@mozilla.com
push dateTue, 06 Sep 2016 14:39:45 +0000
reviewerssmacleod
bugs1300779
milestone51.0a1
Bug 1300779 - [mozlint] Redirect stderr when detecting version control root, r?smacleod This avoids printing harmless (but confusing) errors to the log. For instance, git users will see a '.hg not found!' error in the output even though not finding an hg repo is expected in that case. MozReview-Commit-ID: DBPOabcV7PA
python/mozlint/mozlint/vcs.py
--- a/python/mozlint/mozlint/vcs.py
+++ b/python/mozlint/mozlint/vcs.py
@@ -18,17 +18,17 @@ class VCSFiles(object):
 
         # First check if we're in an hg repo, if not try git
         commands = (
             ['hg', 'root'],
             ['git', 'rev-parse', '--show-toplevel'],
         )
 
         for cmd in commands:
-            proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+            proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
             output = proc.communicate()[0].strip()
 
             if proc.returncode == 0:
                 self._vcs = cmd[0]
                 self._root = output
                 return self._root
 
     @property