Git URL Parser - libvcs.url.git

Detect, parse, and change git URLs using libvcs’s URL parser for git(1). It builds on top of the VCS-friendly URL parser framework.

Detect, parse, and validate git URLs.

libvcs.url.git.DEFAULT_RULES: list[Rule] = <...truncated, 718 chars>
data
data
libvcs.url.git.DEFAULT_RULES: list[Rule] = <...truncated, 718 chars>

Core regular expressions. These are patterns understood by git(1)

See also: https://git-scm.com/docs/git-clone#URLS

libvcs.url.git.AWS_CODE_COMMIT_DEFAULT_RULES: list[Rule] = <...truncated, 1394 chars>
data
data
libvcs.url.git.AWS_CODE_COMMIT_DEFAULT_RULES: list[Rule] = <...truncated, 1394 chars>

AWS CodeCommit-style git URLs.

Examples of CodeCommit-style git URLs (via AWS):

codecommit://MyDemoRepo
codecommit://`CodeCommitProfile`@MyDemoRepo
codecommit::ap-northeast-1://MyDemoRepo

Notes

libvcs.url.git.PIP_DEFAULT_RULES: list[Rule] = <...truncated, 881 chars>
data
data
libvcs.url.git.PIP_DEFAULT_RULES: list[Rule] = <...truncated, 881 chars>

pip-style git URLs.

Examples of PIP-style git URLs (via pip.pypa.io):

MyProject @ git+ssh://git.example.com/MyProject
MyProject @ git+file:///home/user/projects/MyProject
MyProject @ git+https://git.example.com/MyProject

Refs (via pip.pypa.io):

MyProject @ git+https://git.example.com/MyProject.git@master
MyProject @ git+https://git.example.com/MyProject.git@v1.0
MyProject @ git+https://git.example.com/MyProject.git@da39a3ee5e6b4b0d3255bfef95601890afd80709
MyProject @ git+https://git.example.com/MyProject.git@refs/pull/123/head

Notes

libvcs.url.git.NPM_DEFAULT_RULES: list[Rule] = []
data
data
libvcs.url.git.NPM_DEFAULT_RULES: list[Rule] = []

NPM-style git URLs.

Git URL pattern (from docs.npmjs.com):

<protocol>://[<user>[:<password>]@]<hostname>[:<port>][:][/]<path>[#<commit-ish> | #semver:<semver>]

Examples of NPM-style git URLs (from docs.npmjs.com):

ssh://git@github.com:npm/cli.git#v1.0.27
git+ssh://git@github.com:npm/cli#semver:^5.0
git+https://isaacs@github.com/npm/cli.git
git://github.com/npm/cli.git#v1.0.27

Notes

class libvcs.url.git.GitBaseURL
class libvcs.url.git.GitBaseURL

Bases: URLProtocol, SkipDefaultFieldsReprMixin

Git repository location. Parses URLs on initialization.

Examples

>>> GitBaseURL(url='https://github.com/vcs-python/libvcs.git')
GitBaseURL(url=https://github.com/vcs-python/libvcs.git,
        scheme=https,
        hostname=github.com,
        path=vcs-python/libvcs,
        suffix=.git,
        rule=core-git-https)
>>> myrepo = GitBaseURL(url='https://github.com/myproject/myrepo.git')
>>> myrepo.hostname
'github.com'
>>> myrepo.path
'myproject/myrepo'
>>> GitBaseURL(url='[email protected]:vcs-python/libvcs.git')
GitBaseURL([email protected]:vcs-python/libvcs.git,
        user=git,
        hostname=github.com,
        path=vcs-python/libvcs,
        suffix=.git,
        rule=core-git-scp)
class libvcs.url.git.GitAWSCodeCommitURL
class libvcs.url.git.GitAWSCodeCommitURL

Bases: GitBaseURL, URLProtocol, SkipDefaultFieldsReprMixin

Supports AWS CodeCommit git URLs.

class libvcs.url.git.GitPipURL
class libvcs.url.git.GitPipURL

Bases: GitBaseURL, URLProtocol, SkipDefaultFieldsReprMixin

Supports pip git URLs.

class libvcs.url.git.GitURL
class libvcs.url.git.GitURL

Bases: GitAWSCodeCommitURL, GitPipURL, GitBaseURL, URLProtocol, SkipDefaultFieldsReprMixin

Batteries included URL Parser. Supports git(1) and pip URLs.

Ancestors (MRO) This URL parser inherits methods and attributes from the following parsers: