Shortcuts - libvcs._internal.shortcuts¶

Shortcuts for creating repos.

Note

This is an internal API not covered by versioning policy.

exception libvcs._internal.shortcuts.VCSNoMatchFoundForUrl
¶
exception[source]
exception[source]
exception libvcs._internal.shortcuts.VCSNoMatchFoundForUrl
¶
exception libvcs._internal.shortcuts.VCSMultipleMatchFoundForUrl
¶
exception[source]
exception[source]
exception libvcs._internal.shortcuts.VCSMultipleMatchFoundForUrl
¶
exception libvcs._internal.shortcuts.VCSNotSupported
¶
exception[source]
exception[source]
exception libvcs._internal.shortcuts.VCSNotSupported
¶
libvcs._internal.shortcuts.create_project(*, url: str, path: str | PathLike[str], vcs: Literal['git'], progress_callback: ProgressCallbackProtocol | None = None, options: GitOptions | None = None, rev: str | None = None, remotes: None | dict[str, GitRemote] | dict[str, str] = None) → GitSync
¶
function[source]
function[source]
libvcs._internal.shortcuts.create_project(*, url: str, path: str | PathLike[str], vcs: Literal['git'], progress_callback: ProgressCallbackProtocol | None = None, options: GitOptions | None = None, rev: str | None = None, remotes: None | dict[str, GitRemote] | dict[str, str] = None) → GitSync
¶
libvcs._internal.shortcuts.create_project(*, url: str, path: str | PathLike[str], vcs: Literal['svn'], progress_callback: ProgressCallbackProtocol | None = None, options: SvnOptions | None = None, rev: str | None = None) → SvnSync
function
function
libvcs._internal.shortcuts.create_project(*, url: str, path: str | PathLike[str], vcs: Literal['svn'], progress_callback: ProgressCallbackProtocol | None = None, options: SvnOptions | None = None, rev: str | None = None) → SvnSync
libvcs._internal.shortcuts.create_project(*, url: str, path: str | PathLike[str], vcs: Literal['hg'], progress_callback: ProgressCallbackProtocol | None = None, options: HgOptions | None = None, rev: str | None = None, remotes: Mapping[str, HgRemote | str | Mapping[str, str]] | None = None) → HgSync
function
function
libvcs._internal.shortcuts.create_project(*, url: str, path: str | PathLike[str], vcs: Literal['hg'], progress_callback: ProgressCallbackProtocol | None = None, options: HgOptions | None = None, rev: str | None = None, remotes: Mapping[str, HgRemote | str | Mapping[str, str]] | None = None) → HgSync
libvcs._internal.shortcuts.create_project(*, url: str, path: str | PathLike[str], vcs: None = None, progress_callback: ProgressCallbackProtocol | None = None, options: GitOptions | HgOptions | SvnOptions | None = None, rev: str | None = None, remotes: None | dict[str, GitRemote] | dict[str, str] | Mapping[str, HgRemote | str | Mapping[str, str]] = None) → GitSync | HgSync | SvnSync
function
function
libvcs._internal.shortcuts.create_project(*, url: str, path: str | PathLike[str], vcs: None = None, progress_callback: ProgressCallbackProtocol | None = None, options: GitOptions | HgOptions | SvnOptions | None = None, rev: str | None = None, remotes: None | dict[str, GitRemote] | dict[str, str] | Mapping[str, HgRemote | str | Mapping[str, str]] = None) → GitSync | HgSync | SvnSync

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',
...     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

It also supports unprefixed SSH-style Git URLs:

>>> r = create_project(
...     url='[email protected]:tmux-python/tmuxp.git',
...     path=tmp_path
... )
>>> isinstance(r, GitSync)
True