# Path: lbuild/exception.py
# class BlobException(Exception):
#     """
#     Base class for exception thrown by lbuild.
#     """
#     pass


import enum
import logging
import lbuild.config
from ..exception import BlobException
                from . import git
# The file is part of the lbuild project and is released under the
# 2-clause BSD license. See the file `LICENSE.txt` for the full license
# governing this code.



LOGGER = logging.getLogger('lbuild.vcs')


class Action(enum.Enum):
    init = 0
    update = 1


def _parse_vcs(config: lbuild.config.Configuration,
               action):
    LOGGER.debug("Initialize VCS repositories")

    for vcs in config.vcs:
        for tag, repoconfig in vcs.items():
            if tag == "git":
                LOGGER.debug("Found Git repository")

                repo = git.Repository(config.cachefolder, repoconfig)
            else:
                raise BlobException("Unsupported VCS type '{}'".format(tag))

            if action == Action.init:
                repo.initialize()
            elif action == Action.update:

# Path: lbuild/exception.py
# class BlobException(Exception):
#     """
#     Base class for exception thrown by lbuild.
#     """
#     pass


# Path: lbuild/vcs/common.py
import enum
import logging
import lbuild.config
from ..exception import BlobException
                from . import git

# The file is part of the lbuild project and is released under the
# 2-clause BSD license. See the file `LICENSE.txt` for the full license
# governing this code.



LOGGER = logging.getLogger('lbuild.vcs')


class Action(enum.Enum):
    init = 0
    update = 1


def _parse_vcs(config: lbuild.config.Configuration,
               action):
    LOGGER.debug("Initialize VCS repositories")

    for vcs in config.vcs:
        for tag, repoconfig in vcs.items():
            if tag == "git":
                LOGGER.debug("Found Git repository")

                repo = git.Repository(config.cachefolder, repoconfig)
            else:
                raise BlobException("Unsupported VCS type '{}'".format(tag))

            if action == Action.init:
                repo.initialize()
            elif action == Action.update:

                repo.update()