Shortcuts - libvcs._internal.shortcuts¶

Shortcuts for creating repos.

Note

This is an internal API not covered by versioning policy.

exception libvcs._internal.shortcuts.VCSNoMatchFoundForUrl(url, *args)[source]¶

Bases: LibVCSException

Parameters:
Return type:

None

exception libvcs._internal.shortcuts.VCSMultipleMatchFoundForUrl(url, *args)[source]¶

Bases: LibVCSException

Parameters:
Return type:

None

exception libvcs._internal.shortcuts.VCSNotSupported(url, vcs, *args)[source]¶

Bases: LibVCSException

Parameters:
Return type:

None

libvcs._internal.shortcuts.create_project(*, url, path, vcs=None, progress_callback=None, **kwargs)[source]¶

Return an object representation of a VCS repository.

Return type:

Union[GitSync, HgSync, SvnSync]

Parameters:

Examples

>>> from libvcs._internal.shortcuts import create_project
>>> r = create_project(
...     url=f'file://{create_git_remote_repo()}',
...     vcs='git',
...     path=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()}',
...     path=tmp_path
... )
>>> isinstance(r, GitSync)
True