Пример #1
0
    def mercurial_setup(self, update_only=False):
        """Ensure Mercurial is optimally configured.

        This command will inspect your Mercurial configuration and
        guide you through an interactive wizard helping you configure
        Mercurial for optimal use on Mozilla projects.

        User choice is respected: no changes are made without explicit
        confirmation from you.

        If "--update-only" is used, the interactive wizard is disabled
        and this command only ensures that remote repositories providing
        Mercurial extensions are up to date.
        """
        import which
        import mozboot.bootstrap as bootstrap

        # "hg" is an executable script with a shebang, which will be found
        # be which.which. We need to pass a win32 executable to the function
        # because we spawn a process
        # from it.
        if sys.platform in ('win32', 'msys'):
            hg = which.which('hg.exe')
        else:
            hg = which.which('hg')

        if update_only:
            bootstrap.update_vct(hg, self._context.state_dir)
        else:
            bootstrap.configure_mercurial(hg, self._context.state_dir)
Пример #2
0
    def mercurial_setup(self, update_only=False):
        """Ensure Mercurial is optimally configured.

        This command will inspect your Mercurial configuration and
        guide you through an interactive wizard helping you configure
        Mercurial for optimal use on Mozilla projects.

        User choice is respected: no changes are made without explicit
        confirmation from you.

        If "--update-only" is used, the interactive wizard is disabled
        and this command only ensures that remote repositories providing
        Mercurial extensions are up to date.
        """
        import which
        import mozboot.bootstrap as bootstrap

        # "hg" is an executable script with a shebang, which will be found
        # be which.which. We need to pass a win32 executable to the function
        # because we spawn a process
        # from it.
        if sys.platform in ("win32", "msys"):
            hg = which.which("hg.exe")
        else:
            hg = which.which("hg")

        if update_only:
            bootstrap.update_vct(hg, self._context.state_dir)
        else:
            bootstrap.configure_mercurial(hg, self._context.state_dir)
Пример #3
0
def vcs_setup(command_context, update_only=False):
    """Ensure a Version Control System (Mercurial or Git) is optimally
    configured.

    This command will inspect your VCS configuration and
    guide you through an interactive wizard helping you configure the
    VCS for optimal use on Mozilla projects.

    User choice is respected: no changes are made without explicit
    confirmation from you.

    If "--update-only" is used, the interactive wizard is disabled
    and this command only ensures that remote repositories providing
    VCS extensions are up to date.
    """
    import mozboot.bootstrap as bootstrap
    import mozversioncontrol
    from mozfile import which

    repo = mozversioncontrol.get_repository_object(
        command_context._mach_context.topdir)
    tool = "hg"
    if repo.name == "git":
        tool = "git"

    # "hg" is an executable script with a shebang, which will be found by
    # which. We need to pass a win32 executable to the function because we
    # spawn a process from it.
    if sys.platform in ("win32", "msys"):
        tool += ".exe"

    vcs = which(tool)
    if not vcs:
        raise OSError(errno.ENOENT, "Could not find {} on $PATH".format(tool))

    if update_only:
        if repo.name == "git":
            bootstrap.update_git_tools(
                vcs,
                command_context._mach_context.state_dir,
                command_context._mach_context.topdir,
            )
        else:
            bootstrap.update_vct(vcs, command_context._mach_context.state_dir)
    else:
        if repo.name == "git":
            bootstrap.configure_git(
                vcs,
                which("git-cinnabar"),
                command_context._mach_context.state_dir,
                command_context._mach_context.topdir,
            )
        else:
            bootstrap.configure_mercurial(
                vcs, command_context._mach_context.state_dir)
Пример #4
0
    def vcs_setup(self, update_only=False):
        """Ensure a Version Control System (Mercurial or Git) is optimally
        configured.

        This command will inspect your VCS configuration and
        guide you through an interactive wizard helping you configure the
        VCS for optimal use on Mozilla projects.

        User choice is respected: no changes are made without explicit
        confirmation from you.

        If "--update-only" is used, the interactive wizard is disabled
        and this command only ensures that remote repositories providing
        VCS extensions are up to date.
        """
        import which
        import mozboot.bootstrap as bootstrap
        import mozversioncontrol

        repo = mozversioncontrol.get_repository_object(self._context.topdir)
        vcs = 'hg'
        if repo.name == 'git':
            vcs = 'git'

        # "hg" is an executable script with a shebang, which will be found
        # by which.which. We need to pass a win32 executable to the function
        # because we spawn a process
        # from it.
        if sys.platform in ('win32', 'msys'):
            vcs = which.which(vcs + '.exe')
        else:
            vcs = which.which(vcs)

        if update_only:
            if repo.name == 'git':
                bootstrap.update_git_tools(vcs, self._context.state_dir,
                                           self._context.topdir)
            else:
                bootstrap.update_vct(vcs, self._context.state_dir)
        else:
            if repo.name == 'git':
                bootstrap.configure_git(vcs, self._context.state_dir,
                                        self._context.topdir)
            else:
                bootstrap.configure_mercurial(vcs, self._context.state_dir)