зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1197527 - Consolidate obtaining hg path into mozversioncontrol.get_hg_path; r=gps
DONTBUILD --HG-- extra : commitid : LsREOYJSAa7 extra : amend_source : 6f19087188d9c6c009a817c3499c7fd9165bfc6a extra : histedit_source : 36aa6d1a3e78367d50a3e65ac6f61872b7a635d4
This commit is contained in:
Родитель
578bb09fd5
Коммит
bc29413b87
|
@ -7,9 +7,30 @@ from __future__ import unicode_literals
|
|||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import which
|
||||
|
||||
from distutils.version import LooseVersion
|
||||
|
||||
def get_hg_path():
|
||||
"""Obtain the path of the Mercurial client."""
|
||||
|
||||
# We use subprocess in places, which expects a Win32 executable or
|
||||
# batch script. On some versions of MozillaBuild, we have "hg.exe",
|
||||
# "hg.bat," and "hg" (a Python script). "which" will happily return the
|
||||
# Python script, which will cause subprocess to choke. Explicitly favor
|
||||
# the Windows version over the plain script.
|
||||
try:
|
||||
return which.which('hg.exe')
|
||||
except which.WhichError:
|
||||
try:
|
||||
return which.which('hg')
|
||||
except which.WhichError as e:
|
||||
print(e)
|
||||
|
||||
raise Exception('Unable to obtain Mercurial path. Try running ' +
|
||||
'|mach bootstrap| to ensure your environment is up to ' +
|
||||
'date.')
|
||||
|
||||
def get_hg_version(hg):
|
||||
"""Obtain the version of the Mercurial client."""
|
||||
|
||||
|
|
|
@ -4,10 +4,9 @@
|
|||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import errno
|
||||
import os
|
||||
import which
|
||||
|
||||
from mozversioncontrol import get_hg_path
|
||||
from mozversioncontrol.repoupdate import update_mercurial_repo
|
||||
|
||||
from .config import (
|
||||
|
@ -26,13 +25,7 @@ class MercurialUpdater(object):
|
|||
self.vcs_tools_dir = os.path.join(self.state_dir, 'version-control-tools')
|
||||
|
||||
def update_all(self):
|
||||
try:
|
||||
hg = which.which('hg')
|
||||
except which.WhichError as e:
|
||||
print(e)
|
||||
print('Try running |mach bootstrap| to ensure your environment is '
|
||||
'up to date.')
|
||||
return 1
|
||||
hg = get_hg_path()
|
||||
|
||||
repo_existed = os.path.isdir(self.vcs_tools_dir)
|
||||
self.update_mercurial_repo(
|
||||
|
|
|
@ -10,7 +10,6 @@ import os
|
|||
import shutil
|
||||
import stat
|
||||
import sys
|
||||
import which
|
||||
import subprocess
|
||||
|
||||
from distutils.version import LooseVersion
|
||||
|
@ -18,7 +17,7 @@ from distutils.version import LooseVersion
|
|||
from configobj import ConfigObjError
|
||||
from StringIO import StringIO
|
||||
|
||||
from mozversioncontrol import get_hg_version
|
||||
from mozversioncontrol import get_hg_path, get_hg_version
|
||||
|
||||
from .update import MercurialUpdater
|
||||
from .config import (
|
||||
|
@ -245,22 +244,7 @@ class MercurialSetupWizard(object):
|
|||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
# We use subprocess in places, which expects a Win32 executable or
|
||||
# batch script. On some versions of MozillaBuild, we have "hg.exe",
|
||||
# "hg.bat," and "hg" (a Python script). "which" will happily return the
|
||||
# Python script, which will cause subprocess to choke. Explicitly favor
|
||||
# the Windows version over the plain script.
|
||||
try:
|
||||
hg = which.which('hg.exe')
|
||||
except which.WhichError:
|
||||
try:
|
||||
hg = which.which('hg')
|
||||
except which.WhichError as e:
|
||||
print(e)
|
||||
print('Try running |mach bootstrap| to ensure your environment is '
|
||||
'up to date.')
|
||||
return 1
|
||||
|
||||
hg = get_hg_path()
|
||||
config_path = config_file(config_paths)
|
||||
|
||||
try:
|
||||
|
|
Загрузка…
Ссылка в новой задаче