submodule

For git-submodule(1).

class libvcs.cmd.git.GitSubmoduleCmd(*, path, cmd=None)[source]

Bases: object

Run submodule commands in a git repository.

Lite, typed, pythonic wrapper for git-submodule(1).

Parameters:

Examples

>>> GitSubmoduleCmd(path=tmp_path)
<GitSubmoduleCmd path=...>
>>> GitSubmoduleCmd(path=tmp_path).run(quiet=True)
'fatal: not a git repository (or any of the parent directories): .git'
>>> GitSubmoduleCmd(path=git_local_clone.path).run(quiet=True)
''
__init__(*, path, cmd=None)[source]

Lite, typed, pythonic wrapper for git-submodule(1).

Parameters:
Return type:

None

Examples

>>> GitSubmoduleCmd(path=tmp_path)
<GitSubmoduleCmd path=...>
>>> GitSubmoduleCmd(path=tmp_path).run(quiet=True)
'fatal: not a git repository (or any of the parent directories): .git'
>>> GitSubmoduleCmd(path=git_local_clone.path).run(quiet=True)
''
path: Path

Directory to check out

run(command=None, local_flags=None, *, quiet=None, cached=None, log_in_real_time=False, check_returncode=None, **kwargs)[source]

Run a command against a git submodule.

Wraps git submodule.

Return type:

str

Parameters:
  • command (Literal['status', 'init', 'deinit', 'update', 'set-branch', 'set-url', 'summary', 'foreach', 'sync', 'absorbgitdirs'] | None)

  • local_flags (list[str] | None)

  • quiet (bool | None)

  • cached (bool | None)

  • log_in_real_time (bool)

  • check_returncode (bool | None)

  • kwargs (Any)

Examples

>>> GitSubmoduleCmd(path=git_local_clone.path).run()
''
init(*, path=None, log_in_real_time=False, check_returncode=None)[source]

Git submodule init.

Return type:

str

Parameters:

Examples

>>> GitSubmoduleCmd(path=git_local_clone.path).init()
''
update(*, path=None, init=None, force=None, checkout=None, rebase=None, merge=None, recursive=None, log_in_real_time=False, check_returncode=None, **kwargs)[source]

Git submodule update.

Return type:

str

Parameters:

Examples

>>> GitSubmoduleCmd(path=git_local_clone.path).update()
''
>>> GitSubmoduleCmd(path=git_local_clone.path).update(init=True)
''
>>> GitSubmoduleCmd(path=git_local_clone.path).update(init=True, recursive=True)
''
>>> GitSubmoduleCmd(path=git_local_clone.path).update(force=True)
''
>>> GitSubmoduleCmd(path=git_local_clone.path).update(checkout=True)
''
>>> GitSubmoduleCmd(path=git_local_clone.path).update(rebase=True)
''
>>> GitSubmoduleCmd(path=git_local_clone.path).update(merge=True)
''