Skip to content

Commit

Permalink
Merge pull request #1996 from Psycojoker/project-name-in-repr
Browse files Browse the repository at this point in the history
feat(ux): display project.name_with_namespace on project repr
  • Loading branch information
nejch committed May 7, 2022
2 parents 3e0d4d9 + e598762 commit 82c9a07
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions gitlab/v4/objects/projects.py
Expand Up @@ -186,6 +186,16 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
variables: ProjectVariableManager
wikis: ProjectWikiManager

def __repr__(self) -> str:
project_repr = super().__repr__()

if hasattr(self, "name_with_namespace"):
return (
f'{project_repr[:-1]} name_with_namespace:"{self.name_with_namespace}">'
)
else:
return project_repr

@cli.register_custom_action("Project", ("forked_from_id",))
@exc.on_http_error(exc.GitlabCreateError)
def create_fork_relation(self, forked_from_id: int, **kwargs: Any) -> None:
Expand Down

0 comments on commit 82c9a07

Please sign in to comment.