Skip to content

Commit e8631c1

Browse files
author
Gauvain Pocentek
committed
Create a manager for ProjectFork objects
1 parent 37912c1 commit e8631c1

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

gitlab/__init__.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def __init__(self, url, private_token=None,
8888
self.project_commits = ProjectCommitManager(self)
8989
self.project_keys = ProjectKeyManager(self)
9090
self.project_events = ProjectEventManager(self)
91+
self.project_forks = ProjectForkManager(self)
9192
self.project_hooks = ProjectHookManager(self)
9293
self.project_issue_notes = ProjectIssueNoteManager(self)
9394
self.project_issues = ProjectIssueManager(self)
@@ -451,13 +452,6 @@ def UserProject(self, id=None, **kwargs):
451452
DeprecationWarning)
452453
return UserProject._get_list_or_object(self, id, **kwargs)
453454

454-
def ProjectFork(self, id=None, **kwargs):
455-
"""Fork a project for a user.
456-
457-
id must be a dict.
458-
"""
459-
return ProjectFork._get_list_or_object(self, id, **kwargs)
460-
461455
def _list_projects(self, url, **kwargs):
462456
r = self._raw_get(url, **kwargs)
463457
raise_error_from_response(r, GitlabListError)

gitlab/objects.py

+5
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,10 @@ class ProjectFork(GitlabObject):
554554
requiredUrlAttrs = ['project_id']
555555

556556

557+
class ProjectForkManager(BaseManager):
558+
obj_cls = ProjectFork
559+
560+
557561
class ProjectHook(GitlabObject):
558562
_url = '/projects/%(project_id)s/hooks'
559563
requiredUrlAttrs = ['project_id']
@@ -798,6 +802,7 @@ class Project(GitlabObject):
798802
('commits', ProjectCommitManager, [('project_id', 'id')]),
799803
('events', ProjectEventManager, [('project_id', 'id')]),
800804
('files', ProjectFileManager, [('project_id', 'id')]),
805+
('forks', ProjectForkManager, [('project_id', 'id')]),
801806
('hooks', ProjectHookManager, [('project_id', 'id')]),
802807
('keys', ProjectKeyManager, [('project_id', 'id')]),
803808
('issues', ProjectIssueManager, [('project_id', 'id')]),

0 commit comments

Comments
 (0)