Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
2 changes: 1 addition & 1 deletion 2 git/refs/head.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class Head(Reference):
k_config_remote_ref = "merge" # branch to merge from remote

@classmethod
def delete(cls, repo: 'Repo', *heads: 'Head', force: bool = False, **kwargs: Any) -> None:
def delete(cls, repo: 'Repo', *heads: 'Union[Head, str]', force: bool = False, **kwargs: Any) -> None:
"""Delete the given heads

:param force:
Expand Down
7 changes: 6 additions & 1 deletion 7 git/refs/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ def iter_items(cls, repo: 'Repo', common_path: Union[PathLike, None] = None,
# super is Reference
return super(RemoteReference, cls).iter_items(repo, common_path)

# The Head implementation of delete also accepts strs, but this
# implementation does not. mypy doesn't have a way of representing
# tightening the types of arguments in subclasses and recommends Any or
# "type: ignore". (See https://github.com/python/typing/issues/241)
@ classmethod
def delete(cls, repo: 'Repo', *refs: 'RemoteReference', **kwargs: Any) -> None:
def delete(cls, repo: 'Repo', *refs: 'RemoteReference', # type: ignore
**kwargs: Any) -> None:
"""Delete the given remote references

:note:
Expand Down
4 changes: 3 additions & 1 deletion 4 git/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,9 @@ def create(cls, repo: 'Repo', name: str, url: str, **kwargs: Any) -> 'Remote':
return cls(repo, name)

# add is an alias
add = create
@ classmethod
def add(cls, repo: 'Repo', name: str, url: str, **kwargs: Any) -> 'Remote':
return cls.create(repo, name, url, **kwargs)

@ classmethod
def remove(cls, repo: 'Repo', name: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion 2 git/repo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ def create_head(self, path: PathLike, commit: str = 'HEAD',
:return: newly created Head Reference"""
return Head.create(self, path, commit, logmsg, force)

def delete_head(self, *heads: 'Head', **kwargs: Any) -> None:
def delete_head(self, *heads: 'Union[str, Head]', **kwargs: Any) -> None:
"""Delete the given heads

:param kwargs: Additional keyword arguments to be passed to git-branch"""
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.