@@ -545,6 +545,15 @@ class ProjectEventManager(BaseManager):
545
545
obj_cls = ProjectEvent
546
546
547
547
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
+
548
557
class ProjectHook (GitlabObject ):
549
558
_url = '/projects/%(project_id)s/hooks'
550
559
requiredUrlAttrs = ['project_id' ]
@@ -956,6 +965,25 @@ def delete_file(self, path, branch, message, **kwargs):
956
965
r = self .gitlab ._raw_delete (url , ** kwargs )
957
966
raise_error_from_response (r , GitlabDeleteError )
958
967
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
+
959
987
960
988
class TeamMember (GitlabObject ):
961
989
_url = '/user_teams/%(team_id)s/members'
0 commit comments