Mercurial URL Parser - libvcs.url.hg¶
Detect and parse Mercurial URLs through
HgURL, aka
hg(1).
Detect, parse, and validate hg (Mercurial) URLs.
Detect:
HgURL.is_valid()Parse:
HgURLcompare to
urllib.parse.ParseResultOutput
hg(1)URL:HgURL.to_url()
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.
Core regular expressions. These are patterns understood by
hg(1)
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,SkipDefaultFieldsReprMixinMercurial 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)
Compatibility checking:
HgURL.is_valid()URLs compatible with
hg(1):HgURL.to_url()
-
class libvcs.url.hg.HgPipURL¶class libvcs.url.hg.HgPipURL¶
Bases:
HgBaseURL,URLProtocol,SkipDefaultFieldsReprMixinSupports pip hg URLs.
-
class libvcs.url.hg.HgURL¶class libvcs.url.hg.HgURL¶
Bases:
HgPipURL,HgBaseURL,URLProtocol,SkipDefaultFieldsReprMixinBatteries included URL Parser. Supports hg(1) and pip URLs.
Ancestors (MRO) This URL parser inherits methods and attributes from the following parsers: