git-well 0.3.1__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {git_well-0.3.1 → git_well-0.3.2}/PKG-INFO +2 -2
- {git_well-0.3.1 → git_well-0.3.2}/git_well/__init__.py +1 -1
- git_well-0.3.2/git_well/_utils.py +380 -0
- git_well-0.3.2/git_well/git_archive_source.py +1571 -0
- {git_well-0.3.1 → git_well-0.3.2}/git_well/git_autoconf_gpgsign.py +20 -11
- {git_well-0.3.1 → git_well-0.3.2}/git_well/git_branch_cleanup.py +17 -14
- {git_well-0.3.1 → git_well-0.3.2}/git_well/git_branch_upgrade.py +8 -6
- {git_well-0.3.1 → git_well-0.3.2}/git_well/git_discover_remote.py +22 -18
- git_well-0.3.2/git_well/git_rebase_add_continue.py +203 -0
- {git_well-0.3.1 → git_well-0.3.2}/git_well/git_remote_protocol.py +95 -56
- {git_well-0.3.1 → git_well-0.3.2}/git_well/git_squash.py +16 -13
- {git_well-0.3.1 → git_well-0.3.2}/git_well/git_squash_streaks.py +36 -30
- {git_well-0.3.1 → git_well-0.3.2}/git_well/git_stats.py +5 -3
- git_well-0.3.2/git_well/git_sync.py +349 -0
- {git_well-0.3.1 → git_well-0.3.2}/git_well/git_track_upstream.py +8 -5
- {git_well-0.3.1 → git_well-0.3.2}/git_well/git_url_components.py +9 -7
- git_well-0.3.2/git_well/ipfs.py +1143 -0
- {git_well-0.3.1 → git_well-0.3.2}/git_well/main.py +2 -2
- {git_well-0.3.1 → git_well-0.3.2}/git_well/patchdir/git_patchdir_apply.py +10 -8
- {git_well-0.3.1 → git_well-0.3.2}/git_well/patchdir/git_patchdir_save.py +5 -5
- {git_well-0.3.1 → git_well-0.3.2}/git_well/patchdir/patchdir_modal.py +2 -2
- {git_well-0.3.1 → git_well-0.3.2}/git_well/repo.py +6 -4
- {git_well-0.3.1 → git_well-0.3.2}/git_well.egg-info/PKG-INFO +2 -2
- {git_well-0.3.1 → git_well-0.3.2}/git_well.egg-info/SOURCES.txt +1 -0
- {git_well-0.3.1 → git_well-0.3.2}/git_well.egg-info/requires.txt +2 -2
- {git_well-0.3.1 → git_well-0.3.2}/requirements/runtime.txt +1 -1
- git_well-0.3.2/tests/test_bugfixes.py +284 -0
- git_well-0.3.2/tests/test_cli.py +817 -0
- git_well-0.3.2/tests/test_ipfs.py +307 -0
- git_well-0.3.1/git_well/_utils.py +0 -317
- git_well-0.3.1/git_well/git_archive_source.py +0 -774
- git_well-0.3.1/git_well/git_rebase_add_continue.py +0 -248
- git_well-0.3.1/git_well/git_sync.py +0 -345
- git_well-0.3.1/git_well/ipfs.py +0 -1283
- git_well-0.3.1/tests/test_cli.py +0 -164
- git_well-0.3.1/tests/test_ipfs.py +0 -333
- {git_well-0.3.1 → git_well-0.3.2}/MANIFEST.in +0 -0
- {git_well-0.3.1 → git_well-0.3.2}/README.rst +0 -0
- {git_well-0.3.1 → git_well-0.3.2}/git_well/__main__.py +0 -0
- {git_well-0.3.1 → git_well-0.3.2}/git_well/demo/__init__.py +0 -0
- {git_well-0.3.1 → git_well-0.3.2}/git_well/patchdir/__init__.py +0 -0
- {git_well-0.3.1 → git_well-0.3.2}/git_well/py.typed +0 -0
- {git_well-0.3.1 → git_well-0.3.2}/git_well.egg-info/dependency_links.txt +0 -0
- {git_well-0.3.1 → git_well-0.3.2}/git_well.egg-info/entry_points.txt +0 -0
- {git_well-0.3.1 → git_well-0.3.2}/git_well.egg-info/top_level.txt +0 -0
- {git_well-0.3.1 → git_well-0.3.2}/pyproject.toml +0 -0
- {git_well-0.3.1 → git_well-0.3.2}/requirements/docs.txt +0 -0
- {git_well-0.3.1 → git_well-0.3.2}/requirements/optional.txt +0 -0
- {git_well-0.3.1 → git_well-0.3.2}/requirements/tests.txt +0 -0
- {git_well-0.3.1 → git_well-0.3.2}/setup.cfg +0 -0
- {git_well-0.3.1 → git_well-0.3.2}/tests/test_import.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: git_well
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: The git_well module
|
|
5
5
|
Author-email: Jon Crall <erotemic@gmail.com>
|
|
6
6
|
License: Apache 2
|
|
@@ -16,7 +16,7 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
16
16
|
Classifier: Topic :: Utilities
|
|
17
17
|
Requires-Python: >=3.10
|
|
18
18
|
Requires-Dist: ubelt>=1.3.3
|
|
19
|
-
Requires-Dist:
|
|
19
|
+
Requires-Dist: kwconf>=0.10.0; python_version >= "3.10"
|
|
20
20
|
Requires-Dist: rich>=12.4.4; python_version >= "3.8"
|
|
21
21
|
Requires-Dist: rich>=11.2.0; python_version < "3.8" and python_version >= "3.6"
|
|
22
22
|
Requires-Dist: git-python>=1.0.0; python_version >= "2.7"
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Any, TypedDict
|
|
6
|
+
|
|
7
|
+
import ubelt as ub
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def rich_print(*args: Any, **kwargs: Any) -> Any:
|
|
11
|
+
try:
|
|
12
|
+
from rich import print as rich_printer
|
|
13
|
+
except Exception:
|
|
14
|
+
return print(*args, **kwargs)
|
|
15
|
+
else:
|
|
16
|
+
return rich_printer(*args, **kwargs)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def rich_link_path(path: str | os.PathLike[str]) -> str:
|
|
20
|
+
"""
|
|
21
|
+
Return rich markup that makes a filesystem path clickable.
|
|
22
|
+
|
|
23
|
+
This intentionally uses rich's link markup form so terminals that support
|
|
24
|
+
hyperlinks can open local paths directly. Callers should print this with
|
|
25
|
+
:func:`rich_print` or :func:`rich_print_path` when rich is available.
|
|
26
|
+
"""
|
|
27
|
+
path_text = os.fspath(path)
|
|
28
|
+
return f'[link={path_text}]{path_text}[/link]'
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def rich_print_path(
|
|
32
|
+
prefix: str,
|
|
33
|
+
path: str | os.PathLike[str],
|
|
34
|
+
suffix: str = '',
|
|
35
|
+
**kwargs: Any,
|
|
36
|
+
) -> Any:
|
|
37
|
+
"""
|
|
38
|
+
Print a filesystem path as a rich hyperlink when rich is available.
|
|
39
|
+
|
|
40
|
+
If rich cannot be imported, fall back to builtin :func:`print` with the
|
|
41
|
+
plain path text so users do not see raw rich markup.
|
|
42
|
+
"""
|
|
43
|
+
path_text = os.fspath(path)
|
|
44
|
+
try:
|
|
45
|
+
from rich import print as rich_printer
|
|
46
|
+
except Exception:
|
|
47
|
+
msg = f'{prefix}{path_text}{suffix}'
|
|
48
|
+
return print(msg, **kwargs)
|
|
49
|
+
else:
|
|
50
|
+
msg = f'{prefix}{rich_link_path(path_text)}{suffix}'
|
|
51
|
+
return rich_printer(msg, **kwargs)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def cmd_output_text(output: str | bytes | None) -> str:
|
|
55
|
+
"""Normalize command output into text.
|
|
56
|
+
|
|
57
|
+
``ub.cmd`` can be configured to return text, bytes, or no captured output.
|
|
58
|
+
Centralizing this conversion keeps call sites honest and makes the expected
|
|
59
|
+
behavior visible to static type checkers.
|
|
60
|
+
"""
|
|
61
|
+
if output is None:
|
|
62
|
+
return ''
|
|
63
|
+
if isinstance(output, bytes):
|
|
64
|
+
return output.decode(errors='replace')
|
|
65
|
+
return output
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def find_merged_branches(repo: Any, main_branch: str = 'main') -> Any:
|
|
69
|
+
# git branch --merged main
|
|
70
|
+
# main_branch = 'main'
|
|
71
|
+
merged_branch_names = [
|
|
72
|
+
p.replace('*', '').strip()
|
|
73
|
+
for p in repo.git.branch(merged=main_branch).split('\n')
|
|
74
|
+
if p.strip()
|
|
75
|
+
]
|
|
76
|
+
merged_branches = ub.oset(merged_branch_names) - {main_branch}
|
|
77
|
+
return merged_branches
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def confirm(msg: str) -> bool:
|
|
81
|
+
try:
|
|
82
|
+
from rich import prompt
|
|
83
|
+
|
|
84
|
+
ret = prompt.Confirm.ask(msg)
|
|
85
|
+
except ImportError:
|
|
86
|
+
while True:
|
|
87
|
+
ans = input(msg + ' [y/n]')
|
|
88
|
+
if ans in {'y', 'yes'}:
|
|
89
|
+
ret = True
|
|
90
|
+
break
|
|
91
|
+
elif ans in {'n', 'no'}:
|
|
92
|
+
ret = False
|
|
93
|
+
break
|
|
94
|
+
else:
|
|
95
|
+
print('invalid response')
|
|
96
|
+
return ret
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def choice_prompt(msg: str, choices: list[str]) -> str:
|
|
100
|
+
"""
|
|
101
|
+
Ignore:
|
|
102
|
+
choice_prompt('which one?', choices=['a', 'b', 'c'])
|
|
103
|
+
"""
|
|
104
|
+
try:
|
|
105
|
+
from rich.prompt import InvalidResponse, Prompt
|
|
106
|
+
except ImportError:
|
|
107
|
+
print('Rich is required here')
|
|
108
|
+
raise
|
|
109
|
+
|
|
110
|
+
class ChoiceWithIntPrompt(Prompt):
|
|
111
|
+
"""
|
|
112
|
+
Assigns an integer to each choice.
|
|
113
|
+
"""
|
|
114
|
+
|
|
115
|
+
def make_prompt(self, default: Any) -> Any:
|
|
116
|
+
prompt = self.prompt.copy()
|
|
117
|
+
prompt.end = ''
|
|
118
|
+
|
|
119
|
+
if self.show_choices and self.choices:
|
|
120
|
+
prompt.append('\n')
|
|
121
|
+
for idx, choice in enumerate(self.choices, start=1):
|
|
122
|
+
try:
|
|
123
|
+
int(choice)
|
|
124
|
+
except ValueError:
|
|
125
|
+
...
|
|
126
|
+
else:
|
|
127
|
+
raise AssertionError('choices cannot be integers')
|
|
128
|
+
|
|
129
|
+
prompt.append(f'{idx}. ', style='json.number')
|
|
130
|
+
prompt.append(f'{choice}\n', style='prompt')
|
|
131
|
+
if (
|
|
132
|
+
default != ...
|
|
133
|
+
and self.show_default
|
|
134
|
+
and isinstance(default, (str, self.response_type))
|
|
135
|
+
):
|
|
136
|
+
prompt.append(' ')
|
|
137
|
+
_default = self.render_default(default)
|
|
138
|
+
prompt.append(_default)
|
|
139
|
+
|
|
140
|
+
prompt.append(self.prompt_suffix)
|
|
141
|
+
return prompt
|
|
142
|
+
|
|
143
|
+
def process_response(self, value: str) -> str:
|
|
144
|
+
value = value.strip()
|
|
145
|
+
assert self.choices is not None
|
|
146
|
+
try:
|
|
147
|
+
return_value = self.response_type(value)
|
|
148
|
+
except ValueError:
|
|
149
|
+
raise InvalidResponse(self.validate_error_message)
|
|
150
|
+
|
|
151
|
+
try:
|
|
152
|
+
idx = int(return_value) - 1
|
|
153
|
+
return_value = self.choices[idx]
|
|
154
|
+
except Exception:
|
|
155
|
+
...
|
|
156
|
+
|
|
157
|
+
if return_value not in self.choices:
|
|
158
|
+
raise InvalidResponse(self.illegal_choice_message)
|
|
159
|
+
|
|
160
|
+
return return_value
|
|
161
|
+
|
|
162
|
+
return ChoiceWithIntPrompt.ask(msg, choices=choices)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def find_git_root(dpath: str | os.PathLike[str]) -> ub.Path:
|
|
166
|
+
if 0:
|
|
167
|
+
# Old implementation
|
|
168
|
+
cwd = ub.Path(dpath).absolute()
|
|
169
|
+
parts = cwd.parts
|
|
170
|
+
found = None
|
|
171
|
+
for i in reversed(range(0, len(parts) + 1)):
|
|
172
|
+
p = ub.Path(*parts[0:i])
|
|
173
|
+
cand = p / '.git'
|
|
174
|
+
if cand.exists():
|
|
175
|
+
found = p
|
|
176
|
+
break
|
|
177
|
+
if found is None:
|
|
178
|
+
raise Exception('cannot find git root')
|
|
179
|
+
else:
|
|
180
|
+
# New implementation (should be more robust)
|
|
181
|
+
# allow running inside a subdir of a repo
|
|
182
|
+
info = ub.cmd('git rev-parse --show-toplevel', cwd=dpath, verbose=0)
|
|
183
|
+
if info['ret'] != 0:
|
|
184
|
+
raise RuntimeError(f'Not a git repo: {dpath}')
|
|
185
|
+
found = ub.Path(info['out'].strip())
|
|
186
|
+
return found
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
class _GitURLInfoRequired(TypedDict):
|
|
190
|
+
host: str | None
|
|
191
|
+
port: int | None
|
|
192
|
+
group: str
|
|
193
|
+
repo_name: str
|
|
194
|
+
repo_endpoint: str
|
|
195
|
+
user: str | None
|
|
196
|
+
protocol: str
|
|
197
|
+
url: str
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
class GitURLInfo(_GitURLInfoRequired, total=False):
|
|
201
|
+
path: str
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
class GitURL(str):
|
|
205
|
+
"""Parse and convert common network Git remote URL forms.
|
|
206
|
+
|
|
207
|
+
Local paths are parsed so callers can inspect or skip them, but they cannot
|
|
208
|
+
be converted into a network URL without an explicit host.
|
|
209
|
+
|
|
210
|
+
Example:
|
|
211
|
+
>>> from git_well._utils import GitURL
|
|
212
|
+
>>> urls = [
|
|
213
|
+
>>> GitURL('https://foo.bar/group/subgroup/repo.git'),
|
|
214
|
+
>>> GitURL('ssh://git@foo.bar:2222/group/repo.git'),
|
|
215
|
+
>>> GitURL('alice@foo.bar:group/repo.git'),
|
|
216
|
+
>>> GitURL('/home/me/repo.git'),
|
|
217
|
+
>>> ]
|
|
218
|
+
>>> assert urls[0].info['group'] == 'group/subgroup'
|
|
219
|
+
>>> assert urls[0].info['repo_name'] == 'repo'
|
|
220
|
+
>>> assert urls[1].to_ssh() == urls[1]
|
|
221
|
+
>>> assert urls[2].info['user'] == 'alice'
|
|
222
|
+
>>> assert urls[3].info['protocol'] == 'local'
|
|
223
|
+
"""
|
|
224
|
+
|
|
225
|
+
def __init__(self, data: str) -> None:
|
|
226
|
+
self._info: GitURLInfo | None = None
|
|
227
|
+
|
|
228
|
+
@staticmethod
|
|
229
|
+
def _fixup_endpoint(repo_endpoint: str) -> tuple[str, str]:
|
|
230
|
+
if repo_endpoint.endswith('/.git'):
|
|
231
|
+
repo_name = repo_endpoint[: -len('/.git')].rsplit('/', 1)[-1]
|
|
232
|
+
elif repo_endpoint.endswith('.git'):
|
|
233
|
+
repo_name = repo_endpoint[:-4]
|
|
234
|
+
else:
|
|
235
|
+
repo_name = repo_endpoint
|
|
236
|
+
repo_endpoint = repo_name + '.git'
|
|
237
|
+
return repo_name, repo_endpoint
|
|
238
|
+
|
|
239
|
+
@classmethod
|
|
240
|
+
def _split_repo_path(cls, path: str) -> tuple[str, str, str]:
|
|
241
|
+
path = path.strip('/')
|
|
242
|
+
if not path:
|
|
243
|
+
raise ValueError('Git remote URL does not contain a repository path')
|
|
244
|
+
parts = path.split('/')
|
|
245
|
+
if parts[-1] == '.git':
|
|
246
|
+
if len(parts) < 2:
|
|
247
|
+
raise ValueError(f'Invalid explicit-directory Git URL: {path!r}')
|
|
248
|
+
repo_endpoint = parts[-2] + '/.git'
|
|
249
|
+
repo_name = parts[-2]
|
|
250
|
+
group = '/'.join(parts[:-2])
|
|
251
|
+
else:
|
|
252
|
+
repo_name, repo_endpoint = cls._fixup_endpoint(parts[-1])
|
|
253
|
+
group = '/'.join(parts[:-1])
|
|
254
|
+
return group, repo_name, repo_endpoint
|
|
255
|
+
|
|
256
|
+
@property
|
|
257
|
+
def info(self) -> GitURLInfo:
|
|
258
|
+
if self._info is not None:
|
|
259
|
+
return self._info
|
|
260
|
+
|
|
261
|
+
import re
|
|
262
|
+
from urllib.parse import unquote, urlsplit
|
|
263
|
+
|
|
264
|
+
url = str(self)
|
|
265
|
+
info: GitURLInfo
|
|
266
|
+
parsed = urlsplit(url) if '://' in url else None
|
|
267
|
+
if parsed is not None:
|
|
268
|
+
protocol = parsed.scheme.lower()
|
|
269
|
+
if protocol == 'file':
|
|
270
|
+
info = {
|
|
271
|
+
'host': parsed.hostname,
|
|
272
|
+
'port': parsed.port,
|
|
273
|
+
'group': '',
|
|
274
|
+
'repo_name': Path(unquote(parsed.path)).stem,
|
|
275
|
+
'repo_endpoint': Path(unquote(parsed.path)).name,
|
|
276
|
+
'user': parsed.username,
|
|
277
|
+
'protocol': 'file',
|
|
278
|
+
'path': unquote(parsed.path),
|
|
279
|
+
'url': url,
|
|
280
|
+
}
|
|
281
|
+
elif protocol in {'http', 'https', 'ssh', 'git'}:
|
|
282
|
+
group, repo_name, repo_endpoint = self._split_repo_path(
|
|
283
|
+
unquote(parsed.path)
|
|
284
|
+
)
|
|
285
|
+
info = {
|
|
286
|
+
'host': parsed.hostname,
|
|
287
|
+
'port': parsed.port,
|
|
288
|
+
'group': group,
|
|
289
|
+
'repo_name': repo_name,
|
|
290
|
+
'repo_endpoint': repo_endpoint,
|
|
291
|
+
'user': parsed.username,
|
|
292
|
+
'protocol': protocol,
|
|
293
|
+
'url': url,
|
|
294
|
+
}
|
|
295
|
+
else:
|
|
296
|
+
raise ValueError(f'Unsupported Git URL protocol: {protocol!r}')
|
|
297
|
+
else:
|
|
298
|
+
scp_match = re.match(
|
|
299
|
+
r'^(?:(?P<user>[^/@:]+)@)?'
|
|
300
|
+
r'(?P<host>[^/:\\]+):(?P<path>.+)$',
|
|
301
|
+
url,
|
|
302
|
+
)
|
|
303
|
+
is_windows_drive = bool(re.match(r'^[A-Za-z]:[\\/]', url))
|
|
304
|
+
if scp_match and not is_windows_drive:
|
|
305
|
+
group, repo_name, repo_endpoint = self._split_repo_path(
|
|
306
|
+
scp_match.group('path')
|
|
307
|
+
)
|
|
308
|
+
user = scp_match.group('user')
|
|
309
|
+
info = {
|
|
310
|
+
'host': scp_match.group('host'),
|
|
311
|
+
'port': None,
|
|
312
|
+
'group': group,
|
|
313
|
+
'repo_name': repo_name,
|
|
314
|
+
'repo_endpoint': repo_endpoint,
|
|
315
|
+
'user': user,
|
|
316
|
+
'protocol': 'git' if user == 'git' else 'scp',
|
|
317
|
+
'url': url,
|
|
318
|
+
}
|
|
319
|
+
else:
|
|
320
|
+
local_path = Path(url)
|
|
321
|
+
endpoint = local_path.name
|
|
322
|
+
if endpoint == '.git':
|
|
323
|
+
repo_name = local_path.parent.name
|
|
324
|
+
endpoint = repo_name + '/.git'
|
|
325
|
+
else:
|
|
326
|
+
repo_name, endpoint = self._fixup_endpoint(endpoint)
|
|
327
|
+
info = {
|
|
328
|
+
'host': None,
|
|
329
|
+
'port': None,
|
|
330
|
+
'group': '',
|
|
331
|
+
'repo_name': repo_name,
|
|
332
|
+
'repo_endpoint': endpoint,
|
|
333
|
+
'user': None,
|
|
334
|
+
'protocol': 'local',
|
|
335
|
+
'path': url,
|
|
336
|
+
'url': url,
|
|
337
|
+
}
|
|
338
|
+
self._info = info
|
|
339
|
+
return info
|
|
340
|
+
|
|
341
|
+
def _network_path(self) -> str:
|
|
342
|
+
info = self.info
|
|
343
|
+
if not info.get('host'):
|
|
344
|
+
raise ValueError(f'Cannot convert local Git URL: {self!s}')
|
|
345
|
+
parts = [info['group'], info['repo_endpoint']]
|
|
346
|
+
return '/'.join(part for part in parts if part)
|
|
347
|
+
|
|
348
|
+
def to_protocol(self, protocol: str) -> GitURL:
|
|
349
|
+
if protocol == 'git':
|
|
350
|
+
return self.to_git()
|
|
351
|
+
if protocol in {'ssh', 'scp'}:
|
|
352
|
+
return self.to_ssh()
|
|
353
|
+
if protocol == 'https':
|
|
354
|
+
return self.to_https()
|
|
355
|
+
raise KeyError(protocol)
|
|
356
|
+
|
|
357
|
+
def to_git(self) -> GitURL:
|
|
358
|
+
info = self.info
|
|
359
|
+
path = self._network_path()
|
|
360
|
+
host = info['host']
|
|
361
|
+
if info.get('port') is not None:
|
|
362
|
+
return self.__class__(
|
|
363
|
+
f"ssh://git@{host}:{info['port']}/{path}"
|
|
364
|
+
)
|
|
365
|
+
return self.__class__(f'git@{host}:{path}')
|
|
366
|
+
|
|
367
|
+
def to_ssh(self) -> GitURL:
|
|
368
|
+
info = self.info
|
|
369
|
+
path = self._network_path()
|
|
370
|
+
user = info.get('user')
|
|
371
|
+
user_part = '' if user is None else user + '@'
|
|
372
|
+
port_part = '' if info.get('port') is None else f":{info['port']}"
|
|
373
|
+
return self.__class__(
|
|
374
|
+
f"ssh://{user_part}{info['host']}{port_part}/{path}"
|
|
375
|
+
)
|
|
376
|
+
|
|
377
|
+
def to_https(self) -> GitURL:
|
|
378
|
+
info = self.info
|
|
379
|
+
path = self._network_path()
|
|
380
|
+
return self.__class__(f"https://{info['host']}/{path}")
|