Skip to content

Commit b71ce68

Browse files
authored
Merge pull request #1935 from PatrickMassot/main
Change aliases to work around mypy issue.
2 parents 4c21e51 + f96eb0c commit b71ce68

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

Diff for: git/remote.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -828,8 +828,15 @@ def remove(cls, repo: "Repo", name: str) -> str:
828828
name._clear_cache()
829829
return name
830830

831-
# `rm` is an alias.
832-
rm = remove
831+
@classmethod
832+
def rm(cls, repo: "Repo", name: str) -> str:
833+
"""Alias of remove.
834+
Remove the remote with the given name.
835+
836+
:return:
837+
The passed remote name to remove
838+
"""
839+
return cls.remove(repo, name)
833840

834841
def rename(self, new_name: str) -> "Remote":
835842
"""Rename self to the given `new_name`.

Diff for: git/repo/base.py

+20-4
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,17 @@ def heads(self) -> "IterableList[Head]":
402402
"""
403403
return Head.list_items(self)
404404

405+
@property
406+
def branches(self) -> "IterableList[Head]":
407+
"""Alias for heads.
408+
A list of :class:`~git.refs.head.Head` objects representing the branch heads
409+
in this repo.
410+
411+
:return:
412+
``git.IterableList(Head, ...)``
413+
"""
414+
return self.heads
415+
405416
@property
406417
def references(self) -> "IterableList[Reference]":
407418
"""A list of :class:`~git.refs.reference.Reference` objects representing tags,
@@ -412,11 +423,16 @@ def references(self) -> "IterableList[Reference]":
412423
"""
413424
return Reference.list_items(self)
414425

415-
# Alias for references.
416-
refs = references
426+
@property
427+
def refs(self) -> "IterableList[Reference]":
428+
"""Alias for references.
429+
A list of :class:`~git.refs.reference.Reference` objects representing tags,
430+
heads and remote references.
417431
418-
# Alias for heads.
419-
branches = heads
432+
:return:
433+
``git.IterableList(Reference, ...)``
434+
"""
435+
return self.references
420436

421437
@property
422438
def index(self) -> "IndexFile":

0 commit comments

Comments
 (0)