Skip to content

Commit 9bb630f

Browse files
committed
Add remote.url type
1 parent e7b685d commit 9bb630f

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

git/remote.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,9 @@ def __init__(self, repo: 'Repo', name: str) -> None:
449449
450450
:param repo: The repository we are a remote of
451451
:param name: the name of the remote, i.e. 'origin'"""
452-
self.repo = repo # type: 'Repo'
452+
self.repo = repo
453453
self.name = name
454+
self.url: str
454455

455456
def __getattr__(self, attr: str) -> Any:
456457
"""Allows to call this instance like
@@ -558,15 +559,7 @@ def delete_url(self, url: str, **kwargs: Any) -> 'Remote':
558559
"""
559560
return self.set_url(url, delete=True)
560561

561-
@property
562-
def url(self) -> Union[str, List[str]]:
563-
url_list = list(self.urls)
564-
if len(url_list) == 1:
565-
return url_list[0]
566-
else:
567-
return url_list
568-
569-
@property
562+
@ property
570563
def urls(self) -> Iterator[str]:
571564
""":return: Iterator yielding all configured URL targets on a remote as strings"""
572565
try:
@@ -599,7 +592,7 @@ def urls(self) -> Iterator[str]:
599592
else:
600593
raise ex
601594

602-
@property
595+
@ property
603596
def refs(self) -> IterableList[RemoteReference]:
604597
"""
605598
:return:
@@ -610,7 +603,7 @@ def refs(self) -> IterableList[RemoteReference]:
610603
out_refs.extend(RemoteReference.list_items(self.repo, remote=self.name))
611604
return out_refs
612605

613-
@property
606+
@ property
614607
def stale_refs(self) -> IterableList[Reference]:
615608
"""
616609
:return:
@@ -644,7 +637,7 @@ def stale_refs(self) -> IterableList[Reference]:
644637
# END for each line
645638
return out_refs
646639

647-
@classmethod
640+
@ classmethod
648641
def create(cls, repo: 'Repo', name: str, url: str, **kwargs: Any) -> 'Remote':
649642
"""Create a new remote to the given repository
650643
:param repo: Repository instance that is to receive the new remote
@@ -661,7 +654,7 @@ def create(cls, repo: 'Repo', name: str, url: str, **kwargs: Any) -> 'Remote':
661654
# add is an alias
662655
add = create
663656

664-
@classmethod
657+
@ classmethod
665658
def remove(cls, repo: 'Repo', name: str) -> str:
666659
"""Remove the remote with the given name
667660
:return: the passed remote name to remove

0 commit comments

Comments
 (0)