Skip to content

Commit 12b1bfa

Browse files
committed
chore: RemoteDict -> fetch,push -> fetch_url,push_url
1 parent b62d460 commit 12b1bfa

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

libvcs/git.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ def convert_pip_url(pip_url: str) -> VCSLocation:
126126

127127

128128
class RemoteDict(TypedDict):
129-
fetch: str
130-
push: str
129+
fetch_url: str
130+
push_url: str
131131

132132

133133
FullRemoteDict = Dict[str, RemoteDict]
@@ -195,21 +195,23 @@ def __init__(
195195
self._remotes: Union[FullRemoteDict, None]
196196

197197
if remotes is None:
198-
self._remotes: FullRemoteDict = {"origin": {"fetch": url, "push": url}}
198+
self._remotes: FullRemoteDict = {
199+
"origin": {"fetch_url": url, "push_url": url}
200+
}
199201
elif isinstance(remotes, dict):
200202
self._remotes: FullRemoteDict = remotes
201203
for remote_name, url in remotes.items():
202204
if isinstance(url, str):
203205
remotes[remote_name] = {
204-
"fetch": url,
205-
"push": url,
206+
"fetch_url": url,
207+
"push_url": url,
206208
}
207209

208210
BaseRepo.__init__(self, url, repo_dir, *args, **kwargs)
209211
self.url = (
210-
self._remotes.get("origin")["fetch"]
212+
self._remotes.get("origin")["fetch_url"]
211213
if self._remotes.get("origin")
212-
else next(iter(self._remotes.items()))[1]["fetch"]
214+
else next(iter(self._remotes.items()))[1]["fetch_url"]
213215
)
214216

215217
@classmethod
@@ -231,21 +233,24 @@ def set_remotes(self, overwrite: bool = False):
231233
if isinstance(remotes, dict):
232234
for remote_name, url in remotes.items():
233235
existing_remote = self.remote(remote_name)
234-
if isinstance(url, dict) and "fetch" in url:
235-
if not existing_remote or existing_remote.fetch_url != url["fetch"]:
236+
if isinstance(url, dict) and "fetch_url" in url:
237+
if (
238+
not existing_remote
239+
or existing_remote.fetch_url != url["fetch_url"]
240+
):
236241
self.set_remote(
237-
name=remote_name, url=url["fetch"], overwrite=overwrite
242+
name=remote_name, url=url["fetch_url"], overwrite=overwrite
238243
)
239244
# refresh if we're setting it, so push can be checked
240245
existing_remote = self.remote(remote_name)
241-
if "push" in url:
246+
if "push_url" in url:
242247
if (
243248
not existing_remote
244-
or existing_remote.push_url != url["push"]
249+
or existing_remote.push_url != url["push_url"]
245250
):
246251
self.set_remote(
247252
name=remote_name,
248-
url=url["push"],
253+
url=url["push_url"],
249254
push=True,
250255
overwrite=overwrite,
251256
)
@@ -357,7 +362,7 @@ def update_repo(self, set_remotes: bool = False, *args, **kwargs):
357362
return
358363

359364
try:
360-
process = self.run(["fetch"], log_in_real_time=True)
365+
process = self.run(["fetch_url"], log_in_real_time=True)
361366
except exc.CommandError:
362367
self.error("Failed to fetch repository '%s'" % url)
363368
return

0 commit comments

Comments
 (0)