Bug 1393242 - Return a Repository using configure preferences; r?mshal
If configure has defined VCS binaries, we should use those.
MozReview-Commit-ID: DVnsSaJC8eN
--- 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.