Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change aliases to work around mypy issue. #1935

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading