Skip to content

Commit

Permalink
Merge pull request #1935 from PatrickMassot/main
Browse files Browse the repository at this point in the history
Change aliases to work around mypy issue.
  • Loading branch information
Byron authored Jun 24, 2024
2 parents 4c21e51 + f96eb0c commit b71ce68
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
11 changes: 9 additions & 2 deletions git/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,8 +828,15 @@ def remove(cls, repo: "Repo", name: str) -> str:
name._clear_cache()
return name

# `rm` is an alias.
rm = remove
@classmethod
def rm(cls, repo: "Repo", name: str) -> str:
"""Alias of remove.
Remove the remote with the given name.
:return:
The passed remote name to remove
"""
return cls.remove(repo, name)

def rename(self, new_name: str) -> "Remote":
"""Rename self to the given `new_name`.
Expand Down
24 changes: 20 additions & 4 deletions git/repo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,17 @@ def heads(self) -> "IterableList[Head]":
"""
return Head.list_items(self)

@property
def branches(self) -> "IterableList[Head]":
"""Alias for heads.
A list of :class:`~git.refs.head.Head` objects representing the branch heads
in this repo.
:return:
``git.IterableList(Head, ...)``
"""
return self.heads

@property
def references(self) -> "IterableList[Reference]":
"""A list of :class:`~git.refs.reference.Reference` objects representing tags,
Expand All @@ -412,11 +423,16 @@ def references(self) -> "IterableList[Reference]":
"""
return Reference.list_items(self)

# Alias for references.
refs = references
@property
def refs(self) -> "IterableList[Reference]":
"""Alias for references.
A list of :class:`~git.refs.reference.Reference` objects representing tags,
heads and remote references.
# Alias for heads.
branches = heads
:return:
``git.IterableList(Reference, ...)``
"""
return self.references

@property
def index(self) -> "IndexFile":
Expand Down

0 comments on commit b71ce68

Please sign in to comment.