Package API
All of the command-line interface functionality is available from the Python package by importing gitman
.
Init
To generate a sample config for a new project, call:
gitman.init()
Install
To clone/checkout the specified dependencies, call:
gitman.install(*names, root=None, depth=None,
force=False, fetch=False, clean=True skip_changes=False)
with optional arguments:
*names
: optional list of dependency directory names to filter onroot
: specifies the path to the root working treedepth
: number of levels of dependencies to traverseforce
: indicates uncommitted changes can be overwritten and script errors can be ignoredfetch
: indicates the latest branches should always be fetchedclean
: indicates untracked files should be deleted from dependenciesskip_changes
: indicates dependencies with uncommitted changes should be skipped
Update
If any of the dependencies track a branch (rather than a specific commit), the current upstream version of that branch can be checked out by calling:
gitman.update(*names, root=None, depth=None, recurse=False,
force=False, clean=True, lock=None, skip_changes=False)
with optional arguments:
*names
: optional list of dependency directory names to filter onroot
: specifies the path to the root working treedepth
: number of levels of dependencies to traverserecurse
: indicates nested dependencies should also be updatedforce
: indicates uncommitted changes can be overwritten and script errors can be ignoredclean
: indicates untracked files should be deleted from dependencieslock
: indicates updated dependency versions should be recordedskip_changes
: indicates dependencies with uncommitted changes should be skipped
List
To display the currently checked out dependencies, call:
gitman.list(root=None, depth=None, allow_dirty=True)
with optional arguments:
root
: specifies the path to the root working treedepth
: number of levels of dependencies to traverseallow_dirty
: causes uncommitted changes to be ignored
Lock
To record the exact versions of currently checked out dependencies, call:
gitman.lock(*names, root=None)
with optional arguments:
*names
: optional list of dependency directory names to filter onroot
: specifies the path to the root working tree
Uninstall
To delete all dependencies, call:
gitman.uninstall(root=None, force=False, keep_location=False)
with optional arguments:
root
: specifies the path to the root working treeforce
: indicates uncommitted changes can be overwrittenkeep_location
: indicates that the top level folder should be kept