gitws package

Git Workspace - Multi Repository Management Tool.

git ws is a simple and lean multi repository management tool, with the following features:

  • Integrated into git command line interface

  • Dependency and transient dependency handling

  • Relative URL support

The GitWS class provides a simple programmatic interface similar to the command line interface. See GitWS for all details.

Getting Started

There are 4 ways to create a GitWS instances in the different scenarios:

The python module is named gitws:

>>> import gitws

Assume an existing git clone with an empty parent directory:

>>> import pathlib
>>> main_path = pathlib.Path('main')
>>> gitws.Git.init(main_path)
Git(...)

Create a manifest:

>>> manifest = gitws.ManifestSpec(defaults=gitws.Defaults(revision='main'))
>>> gitws.save(manifest, main_path / "git-ws.toml")

Initialize Workspace

>>> gws = gitws.GitWS.init(main_path=main_path)
>>> gws
GitWS(...)

In case of an existing Git Workspace in your current working directory just run:

>>> gws = gitws.GitWS.from_path()

GitWS.update() updates all dependencies

>>> gws.update()

Run a shell command on all git clones

>>> gws.run_foreach(['ls', '-l'])

For more advanced operations, the GitWS.clones iterates over all clones, starting from the main project.

>>> for clone in gws.clones():
...     print(f"=== {clone.info} ===")
...     clone.project
...     clone.git
=== main (MAIN 'main') ===
Project(name='main', path='main', level=0, is_main=True)
Git(...)

Overview

  • gitws.GitWS: the central API to the main functionality.

  • gitws.Clone: is the pair of Of gitws.Project And gitws.Git Interface.

  • gitws.Git: provides a reduced API to git.

  • gitws.ManifestSpec: Manifest specification for the current project.

  • gitws.Manifest: Manifest as needed by gitws.GitWS derived from gitws.ManifestSpec.

  • gitws.ProjectSpec: Dependency Specification in gitws.ManifestSpec.

  • gitws.Project: A Single Dependency as needed by gitws.GitWS derived from gitws.ProjectSpec.

  • gitws.Remote: Remote Alias in gitws.ManifestSpec.

  • gitws.Defaults: Default Values in gitws.ManifestSpec.

  • gitws.AppConfigData: gitws.GitWS Configuration.

  • gitws.Workspace: the file system location containing all git clones.

Submodules