Bug 1393242 - Return a Repository using configure preferences; r?mshal draft
authorGregory Szorc <gps@mozilla.com>
Wed, 23 Aug 2017 15:04:46 -0700
changeset 657531 b73a8ce2cb7b7aa7678e6423929c88168be12bdd
parent 657530 f67eb9c2fca1c26f6872e6dd1b985a345d3045df
child 657532 31067e1c7137c373c1148b933105c5b066365e9d
push id77552
push usergszorc@mozilla.com
push dateFri, 01 Sep 2017 16:20:16 +0000
reviewersmshal
bugs1393242
milestone57.0a1
Bug 1393242 - Return a Repository using configure preferences; r?mshal If configure has defined VCS binaries, we should use those. MozReview-Commit-ID: DVnsSaJC8eN
python/mozbuild/mozbuild/base.py
--- a/python/mozbuild/mozbuild/base.py
+++ b/python/mozbuild/mozbuild/base.py
@@ -9,17 +9,20 @@ import logging
 import mozpack.path as mozpath
 import multiprocessing
 import os
 import subprocess
 import sys
 import which
 
 from mach.mixin.process import ProcessExecutionMixin
-from mozversioncontrol import get_repository_object
+from mozversioncontrol import (
+    get_repository_from_build_config,
+    get_repository_object,
+)
 
 from .backend.configenvironment import ConfigEnvironment
 from .controller.clobber import Clobberer
 from .mozconfig import (
     MozconfigFindException,
     MozconfigLoadException,
     MozconfigLoader,
 )
@@ -281,16 +284,23 @@ class MozbuildObject(ProcessExecutionMix
                             key, value = e.split('=')
                             env[key] = value
         return env
 
     @memoized_property
     def repository(self):
         '''Get a `mozversioncontrol.Repository` object for the
         top source directory.'''
+        # We try to obtain a repo using the configured VCS info first.
+        # If we don't have a configure context, fall back to auto-detection.
+        try:
+            return get_repository_from_build_config(self)
+        except BuildEnvironmentNotFoundException:
+            pass
+
         return get_repository_object(self.topsrcdir)
 
     @memoized_property
     def python3(self):
         """Obtain info about a Python 3 executable.
 
         Returns a tuple of an executable path and its version (as a tuple).
         Either both entries will have a value or both will be None.