summaryrefslogtreecommitdiff
path: root/lib/api/projects.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-07-10 03:54:58 -0700
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-07-10 03:54:58 -0700
commit90d497056fe68593f54886e2d546eaff1315227c (patch)
tree427d4c62cdddb50623f2ea1975027f59a4f70ac4 /lib/api/projects.rb
parentd2d566b162b60a2d310dfcdbcd0963c2156dd5ae (diff)
parentea5a006f27cfd3013f94652e0e0f0e63091036ad (diff)
downloadgitlab-ce-90d497056fe68593f54886e2d546eaff1315227c.tar.gz
Merge pull request #4515 from amacarthur/fork-admin
Additon of apis for fork administration.
Diffstat (limited to 'lib/api/projects.rb')
-rw-r--r--lib/api/projects.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index 6dc051e4ba2..d5709f5cb59 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -121,6 +121,42 @@ module API
end
+ # Mark this project as forked from another
+ #
+ # Parameters:
+ # id: (required) - The ID of the project being marked as a fork
+ # forked_from_id: (required) - The ID of the project it was forked from
+ # Example Request:
+ # POST /projects/:id/fork/:forked_from_id
+ post ":id/fork/:forked_from_id" do
+ authenticated_as_admin!
+ forked_from_project = find_project(params[:forked_from_id])
+ unless forked_from_project.nil?
+ if user_project.forked_from_project.nil?
+ user_project.create_forked_project_link(forked_to_project_id: user_project.id, forked_from_project_id: forked_from_project.id)
+ else
+ render_api_error!("Project already forked", 409)
+ end
+ else
+ not_found!
+ end
+
+ end
+
+ # Remove a forked_from relationship
+ #
+ # Parameters:
+ # id: (required) - The ID of the project being marked as a fork
+ # Example Request:
+ # DELETE /projects/:id/fork
+ delete ":id/fork" do
+ authenticated_as_admin!
+ unless user_project.forked_project_link.nil?
+ user_project.forked_project_link.destroy
+ end
+ end
+
+
# Get a project team members
#
# Parameters: