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:
GitWS.from_path(): CreateGitWSfor EXISTING workspace atpath.GitWS.create(): Create NEW workspace atpathand return correspondingGitWS.GitWS.init(): Initialize NEW Workspace and return correspondingGitWS.GitWS.clone(): Clone giturl, initialize NEW Workspace and return correspondingGitWS.
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 Ofgitws.ProjectAndgitws.GitInterface.gitws.Git: provides a reduced API togit.gitws.ManifestSpec: Manifest specification for the current project.gitws.Manifest: Manifest as needed bygitws.GitWSderived fromgitws.ManifestSpec.gitws.ProjectSpec: Dependency Specification ingitws.ManifestSpec.gitws.Project: A Single Dependency as needed bygitws.GitWSderived fromgitws.ProjectSpec.gitws.Remote: Remote Alias ingitws.ManifestSpec.gitws.Defaults: Default Values ingitws.ManifestSpec.gitws.AppConfigData:gitws.GitWSConfiguration.gitws.Workspace: the file system location containing all git clones.
Submodules
- gitws.appconfig module
- gitws.clone module
- gitws.const module
- gitws.datamodel module
- gitws.exceptions module
FileRefConflictFileRefModifiedErrorGitCloneMissingErrorGitCloneMissingOriginErrorGitCloneNotCleanErrorGitTagExistsErrorIncompatibleFormatErrorInitializedErrorInvalidConfigurationFileErrorInvalidConfigurationLocationErrorInvalidConfigurationOptionErrorInvalidConfigurationValueErrorManifestErrorManifestExistErrorManifestNotFoundErrorNoAbsUrlErrorNoGitErrorNoMainErrorNotEmptyErrorOutsideWorkspaceErrorUninitializedErrorWorkspaceNotEmptyError
- gitws.git module
- gitws.gitws module
- gitws.gitwsmanifestformat module
- gitws.manifestfinder module
- gitws.manifestformat module
- gitws.workspace module
- gitws.workspacefinder module