How to use the gitman.exceptions.InvalidConfig function in gitman

To help you get started, we’ve selected a few gitman examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jacebrowning / gitman / tests / test_api.py View on Github external
repo: https://github.com/jacebrowning/gitman-demo
                  rev: example-branch
                - name: gitman_2
                  type: git
                  repo: https://github.com/jacebrowning/gitman-demo
                  rev: example-branch
                groups:
                - name: gitman_1
                  members:
                  - gitman_1
                  - gitman_2
            """
        )
        config.datafile.load()

        with pytest.raises(InvalidConfig):
            gitman.update(depth=1, lock=True)
github jacebrowning / gitman / gitman / cli.py View on Github external
exit_message = None
    try:
        log.debug("Running %s command...", getattr(function, '__name__', 'a'))
        success = function(*args, **kwargs)
    except KeyboardInterrupt:
        log.debug("Command canceled")
    except exceptions.UncommittedChanges as exception:
        _show_error(exception)
        exit_message = (
            "Run again with --force/--force-interactive to discard changes "
            "or '--skip-changes' to skip this dependency"
        )
    except exceptions.ScriptFailure as exception:
        _show_error(exception)
        exit_message = "Run again with '--force' to ignore script errors"
    except exceptions.InvalidConfig as exception:
        _show_error(exception)
        exit_message = "Adapt config and run again"
    finally:
        if exit_message:
            common.show(exit_message, color='message')
            common.newline()

    if success:
        log.debug("Command succeeded")
    else:
        log.debug("Command failed")
        sys.exit(1)
github jacebrowning / gitman / gitman / models / config.py View on Github external
def _on_post_load(self):
        for source in self.sources:
            source._on_post_load()  # pylint: disable=protected-access

        for source in self.sources_locked:
            source._on_post_load()  # pylint: disable=protected-access

        # check for conflicts between source names and group names
        for source in self.sources:
            for group in self.groups:
                if source.name == group.name:
                    msg = (
                        "Name conflict detected between source name and "
                        "group name \"{}\""
                    ).format(source.name)
                    raise exceptions.InvalidConfig(msg)
github jacebrowning / gitman / gitman / models / source.py View on Github external
sparse_paths=None,
    ):

        super().__init__()
        self.type = type or 'git'
        self.repo = repo
        self.name = self._infer_name(repo) if name is None else name
        self.rev = rev
        self.link = link
        self.scripts = scripts or []
        self.sparse_paths = sparse_paths or []

        for key in ['name', 'repo', 'rev']:
            if not self[key]:
                msg = "'{}' required for {}".format(key, repr(self))
                raise exceptions.InvalidConfig(msg)
github jacebrowning / gitman / gitman / models / group.py View on Github external
def __init__(self, name, members):

        super().__init__()
        self.name = name
        self.members = members or []

        for key in ['name', 'members']:
            if not self[key]:
                msg = "'{}' required for {}".format(key, repr(self))
                raise exceptions.InvalidConfig(msg)