Skip to content

Commit

Permalink
Create a manager for ProjectFork objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauvain Pocentek committed Jan 8, 2016
1 parent 37912c1 commit e8631c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 1 addition & 7 deletions gitlab/__init__.py
Expand Up @@ -88,6 +88,7 @@ def __init__(self, url, private_token=None,
self.project_commits = ProjectCommitManager(self)
self.project_keys = ProjectKeyManager(self)
self.project_events = ProjectEventManager(self)
self.project_forks = ProjectForkManager(self)
self.project_hooks = ProjectHookManager(self)
self.project_issue_notes = ProjectIssueNoteManager(self)
self.project_issues = ProjectIssueManager(self)
Expand Down Expand Up @@ -451,13 +452,6 @@ def UserProject(self, id=None, **kwargs):
DeprecationWarning)
return UserProject._get_list_or_object(self, id, **kwargs)

def ProjectFork(self, id=None, **kwargs):
"""Fork a project for a user.
id must be a dict.
"""
return ProjectFork._get_list_or_object(self, id, **kwargs)

def _list_projects(self, url, **kwargs):
r = self._raw_get(url, **kwargs)
raise_error_from_response(r, GitlabListError)
Expand Down
5 changes: 5 additions & 0 deletions gitlab/objects.py
Expand Up @@ -554,6 +554,10 @@ class ProjectFork(GitlabObject):
requiredUrlAttrs = ['project_id']


class ProjectForkManager(BaseManager):
obj_cls = ProjectFork


class ProjectHook(GitlabObject):
_url = '/projects/%(project_id)s/hooks'
requiredUrlAttrs = ['project_id']
Expand Down Expand Up @@ -798,6 +802,7 @@ class Project(GitlabObject):
('commits', ProjectCommitManager, [('project_id', 'id')]),
('events', ProjectEventManager, [('project_id', 'id')]),
('files', ProjectFileManager, [('project_id', 'id')]),
('forks', ProjectForkManager, [('project_id', 'id')]),
('hooks', ProjectHookManager, [('project_id', 'id')]),
('keys', ProjectKeyManager, [('project_id', 'id')]),
('issues', ProjectIssueManager, [('project_id', 'id')]),
Expand Down

0 comments on commit e8631c1

Please sign in to comment.