git_well._utils module¶
- class git_well._utils.GitURL(data: str)[source]¶
Bases:
strRepresents a url to a git repo and can parse info about / modify the protocol
References
https://git-scm.com/docs/git-clone#_git_urls
CommandLine
xdoctest -m git_well.git_remote_protocol GitURL
Example
>>> from git_well.git_remote_protocol import * # NOQA >>> from git_well._utils import * # NOQA >>> urls = [ >>> GitURL('https://foo.bar/user/repo.git'), >>> GitURL('ssh://foo.bar/user/repo.git'), >>> GitURL('ssh://git@foo.bar/user/repo.git'), >>> GitURL('git@foo.bar:group/repo.git'), >>> GitURL('host:path/to/my/repo/.git'), >>> ] >>> for url in urls: >>> info = url.info >>> print('---') >>> print(f'url = {url}') >>> print(ub.urepr(info)) >>> print('As git : ' + url.to_git()) >>> print('As ssh : ' + url.to_ssh()) >>> print('As https : ' + url.to_https()) >>> if info['protocol'] not in {'scp'}: >>> # SCP recon is broken >>> recon = url.to_protocol(info['protocol']) >>> assert recon == url