Shortcuts - libvcs._internal.shortcuts#

Shortcuts for creating repos.

Note

This is an internal API not covered by versioning policy.

libvcs._internal.shortcuts.create_project(*, url: str, dir: Union[str, PathLike[str]], vcs: Literal['git'], progress_callback: Optional[ProgressCallbackProtocol] = None, **kwargs: dict[Any, Any]) GitSync[source]#
libvcs._internal.shortcuts.create_project(*, url: str, dir: Union[str, PathLike[str]], vcs: Literal['svn'], progress_callback: Optional[ProgressCallbackProtocol] = None, **kwargs: dict[Any, Any]) SvnSync
libvcs._internal.shortcuts.create_project(*, url: str, dir: Union[str, PathLike[str]], vcs: Literal['hg'], progress_callback: Optional[ProgressCallbackProtocol] = None, **kwargs: dict[Any, Any]) HgSync

Return an object representation of a VCS repository.

Examples

>>> from libvcs._internal.shortcuts import create_project
>>> r = create_project(
...     url=f'file://{create_git_remote_repo()}',
...     vcs='git',
...     dir=tmp_path
... )
>>> isinstance(r, GitSync)
True

create_project can also guess VCS for certain URLs:

>>> r = create_project(
...     # Note the git+ before the URL
...     url=f'git+file://{create_git_remote_repo()}',
...     dir=tmp_path
... )
>>> isinstance(r, GitSync)
True
Return type:

Union[GitSync, HgSync, SvnSync]