summaryrefslogtreecommitdiff
path: root/git
diff options
context:
space:
mode:
authorYobmod <yobmod@gmail.com>2021-07-09 15:53:45 +0100
committerYobmod <yobmod@gmail.com>2021-07-09 15:53:45 +0100
commit9bb630f03a276a4f1ecc6d6909f82dc90f533026 (patch)
treedf3cf1df17cd8cca3283de4c89ec3fb7c4e7ff91 /git
parente7b685db1bf4d9d6aa3f95f4df3fda5992dab14c (diff)
downloadgitpython-9bb630f03a276a4f1ecc6d6909f82dc90f533026.tar.gz
Add remote.url type
Diffstat (limited to 'git')
-rw-r--r--git/remote.py21
1 files changed, 7 insertions, 14 deletions
diff --git a/git/remote.py b/git/remote.py
index 3c3d3c48..f59b3245 100644
--- a/git/remote.py
+++ b/git/remote.py
@@ -449,8 +449,9 @@ class Remote(LazyMixin, IterableObj):
:param repo: The repository we are a remote of
:param name: the name of the remote, i.e. 'origin'"""
- self.repo = repo # type: 'Repo'
+ self.repo = repo
self.name = name
+ self.url: str
def __getattr__(self, attr: str) -> Any:
"""Allows to call this instance like
@@ -558,15 +559,7 @@ class Remote(LazyMixin, IterableObj):
"""
return self.set_url(url, delete=True)
- @property
- def url(self) -> Union[str, List[str]]:
- url_list = list(self.urls)
- if len(url_list) == 1:
- return url_list[0]
- else:
- return url_list
-
- @property
+ @ property
def urls(self) -> Iterator[str]:
""":return: Iterator yielding all configured URL targets on a remote as strings"""
try:
@@ -599,7 +592,7 @@ class Remote(LazyMixin, IterableObj):
else:
raise ex
- @property
+ @ property
def refs(self) -> IterableList[RemoteReference]:
"""
:return:
@@ -610,7 +603,7 @@ class Remote(LazyMixin, IterableObj):
out_refs.extend(RemoteReference.list_items(self.repo, remote=self.name))
return out_refs
- @property
+ @ property
def stale_refs(self) -> IterableList[Reference]:
"""
:return:
@@ -644,7 +637,7 @@ class Remote(LazyMixin, IterableObj):
# END for each line
return out_refs
- @classmethod
+ @ classmethod
def create(cls, repo: 'Repo', name: str, url: str, **kwargs: Any) -> 'Remote':
"""Create a new remote to the given repository
:param repo: Repository instance that is to receive the new remote
@@ -661,7 +654,7 @@ class Remote(LazyMixin, IterableObj):
# add is an alias
add = create
- @classmethod
+ @ classmethod
def remove(cls, repo: 'Repo', name: str) -> str:
"""Remove the remote with the given name
:return: the passed remote name to remove