@@ -545,6 +545,15 @@ class ProjectEventManager(BaseManager):
545545 obj_cls = ProjectEvent
546546
547547
548+ class ProjectFork (GitlabObject ):
549+ _url = '/projects/fork/%(project_id)s'
550+ canUpdate = False
551+ canDelete = False
552+ canList = False
553+ canGet = False
554+ requiredUrlAttrs = ['project_id' ]
555+
556+
548557class ProjectHook (GitlabObject ):
549558 _url = '/projects/%(project_id)s/hooks'
550559 requiredUrlAttrs = ['project_id' ]
@@ -956,6 +965,25 @@ def delete_file(self, path, branch, message, **kwargs):
956965 r = self .gitlab ._raw_delete (url , ** kwargs )
957966 raise_error_from_response (r , GitlabDeleteError )
958967
968+ def create_fork_relation (self , forked_from_id ):
969+ """Create a forked from/to relation between existing projects.
970+
971+ Args:
972+ forked_from_id (int): The ID of the project that was forked from
973+
974+ Raises:
975+ GitlabCreateError: Operation failed
976+ GitlabConnectionError: Connection to GitLab-server failed
977+ """
978+ url = "/projects/%s/fork/%s" % (self .id , forked_from_id )
979+ r = self .gitlab ._raw_post (url )
980+ raise_error_from_response (r , GitlabCreateError , 201 )
981+
982+ def delete_fork_relation (self ):
983+ url = "/projects/%s/fork" % self .id
984+ r = self .gitlab ._raw_delete (url )
985+ raise_error_from_response (r , GitlabDeleteError )
986+
959987
960988class TeamMember (GitlabObject ):
961989 _url = '/user_teams/%(team_id)s/members'
0 commit comments