How to use the gitman.common.dedent 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 / gitman / cli.py View on Github external
def _show_error(exception):
    common.dedent(0)
    common.newline()
    common.show(str(exception), color='error')
    common.newline()
github jacebrowning / gitman / gitman / models / config.py View on Github external
def get_top_level_dependencies(self):
        """Yield the path, repository, and hash of top-level dependencies."""
        if not os.path.exists(self.location_path):
            return

        shell.cd(self.location_path)
        common.newline()
        common.indent()

        for source in self.sources:

            yield os.path.join(self.location_path, source.name)

            shell.cd(self.location_path, _show=False)

        common.dedent()
github jacebrowning / gitman / gitman / commands.py View on Github external
- `root`: specifies the path to the root working tree
    - `force`: indicates uncommitted changes can be overwritten
    - `keep_location`: delete top level folder or keep the location

    """
    log.info("Deleting dependencies...")
    count = None

    config = load_config(root)

    if config:
        common.newline()
        common.show("Checking for uncommitted changes...", color='message', log=False)
        common.newline()
        count = len(list(config.get_dependencies(allow_dirty=force)))
        common.dedent(level=0)
        common.show("Deleting all dependencies...", color='message', log=False)
        common.newline()
        if keep_location:
            config.clean_dependencies()
        else:
            config.uninstall_dependencies()

    return _display_result("delete", "Deleted", count, allow_zero=True)
github jacebrowning / gitman / gitman / commands.py View on Github external
- `*names`: optional list of dependency directory names to filter on
    - `root`: specifies the path to the root working tree

    """
    log.info("Locking dependencies...")
    count = None

    config = load_config(root)

    if config:
        common.newline()
        common.show("Locking dependencies...", color='message', log=False)
        common.newline()
        count = config.lock_dependencies(*names, obey_existing=False)
        common.dedent(level=0)

    return _display_result("lock", "Locked", count)
github jacebrowning / gitman / gitman / models / config.py View on Github external
if source_locked is not None:
                try:
                    index = self.sources_locked.index(source)
                except ValueError:
                    self.sources_locked.append(source_locked)
                else:
                    self.sources_locked[index] = source_locked
                count += 1

            shell.cd(self.location_path, _show=False)

        if count:
            self.save()

        common.dedent()

        return count
github jacebrowning / gitman / gitman / models / config.py View on Github external
continue

            yield source.identify(allow_dirty=allow_dirty)

            config = load_config(search=False)
            if config:
                common.indent()
                yield from config.get_dependencies(
                    depth=None if depth is None else max(0, depth - 1),
                    allow_dirty=allow_dirty,
                )
                common.dedent()

            shell.cd(self.location_path, _show=False)

        common.dedent()