Mercurial URL Parser - libvcs.url.hg¶

Detect and parse Mercurial URLs through HgURL, aka hg(1).

Detect, parse, and validate hg (Mercurial) URLs.

Note

Mercurial URL support is experimental. If you rely on these URL shapes in production, please verify them against your hosts and report gaps in the project tracker.

libvcs.url.hg.DEFAULT_RULES: list[Rule] = <...truncated, 634 chars>
¶
data
data
libvcs.url.hg.DEFAULT_RULES: list[Rule] = <...truncated, 634 chars>
¶

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

libvcs.url.hg.PIP_DEFAULT_RULES: list[Rule] = <...truncated, 513 chars>
¶
data
data
libvcs.url.hg.PIP_DEFAULT_RULES: list[Rule] = <...truncated, 513 chars>
¶

pip-style hg URLs.

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

MyProject @ hg+http://hg.myproject.org/MyProject
MyProject @ hg+https://hg.myproject.org/MyProject
MyProject @ hg+ssh://hg.myproject.org/MyProject
MyProject @ hg+file:///home/user/projects/MyProject

Refs (via pip.pypa.io):

MyProject @ hg+http://hg.example.com/MyProject@da39a3ee5e6b
MyProject @ hg+http://hg.example.com/MyProject@2019
MyProject @ hg+http://hg.example.com/MyProject@v1.0
MyProject @ hg+http://hg.example.com/MyProject@special_feature

Notes

class libvcs.url.hg.HgBaseURL
¶
class libvcs.url.hg.HgBaseURL
¶

Bases: URLProtocol, SkipDefaultFieldsReprMixin

Mercurial repository location. Parses URLs on initialization.

Examples

>>> HgBaseURL(url='https://hg.mozilla.org/mozilla-central/')
HgBaseURL(url=https://hg.mozilla.org/mozilla-central/,
        scheme=https,
        hostname=hg.mozilla.org,
        path=mozilla-central/,
        rule=core-hg)
>>> myrepo = HgURL(url='https://hg.mozilla.org/mozilla-central/')
>>> myrepo.hostname
'hg.mozilla.org'
>>> myrepo.path
'mozilla-central/'
>>> HgBaseURL.is_valid(url='ssh://username@machinename/path/to/repo')
True
>>> HgBaseURL(url='ssh://username@machinename/path/to/repo')
HgBaseURL(url=ssh://username@machinename/path/to/repo,
        scheme=ssh,
        user=username,
        hostname=machinename,
        path=path/to/repo,
        rule=core-hg)
class libvcs.url.hg.HgPipURL
¶
class libvcs.url.hg.HgPipURL
¶

Bases: HgBaseURL, URLProtocol, SkipDefaultFieldsReprMixin

Supports pip hg URLs.

class libvcs.url.hg.HgURL
¶
class libvcs.url.hg.HgURL
¶

Bases: HgPipURL, HgBaseURL, URLProtocol, SkipDefaultFieldsReprMixin

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

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