gitlab-org--gitlab-foss/spec
Dmitriy Zaporozhets ca1c35aa51 Merge branch 'fork-via-API' into 'master'
API: Add support for forking a project via the API

This adds an API call to create a fork of a project.

Such API "fork button" has been requested by feature requests summing up with 37 votes.

The GitLab user has flagged one of them as accepting merge/pull requests for this feature.

Motivation:

The ability to create a fork is missing in the API.
(The API currently only supports adding and removing the "forked" relationship between two existing projects)

This feature (create fork thru the API) feature has been requested via two feature requests:

15 votes, 13 comments: to be able to fork a project through the API
http://feedback.gitlab.com/forums/176466-general/suggestions/4125380-to-be-able-to-fork-a-project-through-the-api (it was marked as completed in error by referring to the much more special change which allows to add&delete fork information)

22 votes, 3 comments: add a "fork project" API call that acts like the "fork button"
http://feedback.gitlab.com/forums/176466-general/suggestions/5820264-add-a-fork-project-api-call-that-acts-like-the

The implementation is described in the text of the commit message (click on the "..." field to open it).

A comprehensive test suite is added as well: It covers all 5 success / failure modes:
1. Success case
2. Failure if authenticated user has no access the the project to be forked
3. Failure if the forked project already exists in the authenticated user's namespace
4. Failure if the forked project does not exist
5. Failure if not authenticated

Documentation for the new API call is added to the project help page: doc/api/projects.md

I have 2 additional merge requests in progress, one is based on this feature and extend it, the other is related to querying forks.

The merge request that would be directly related is based on a request written comment of one of the feature requests (that was independently also requested in a but entry):
The ability to fork a project (thru the API) to a given namespace, eg. a group, in one case, for trainings.

As this request does not change code, but only adds a new request API for creating forks, it does not have
the capability to break existing code, and as the test spec demonstrates, it works.

It allocates the API request POST /projects/fork/:id, the only other API path I'd have thought of would have been POST /projects/:id/fork but that path is already taken by the API for creating a new fork relationship between projects, so POST /projects/fork/:id is the remaining possibility that I could see.

See merge request !191
2014-10-01 10:20:57 +00:00
..
controllers Fix tests 2014-08-07 20:46:17 +03:00
factories Replace project_access attribute with access_level in specs and API 2014-09-15 11:36:50 +03:00
features Remove unnecessary page. from tests. 2014-09-26 09:51:17 +02:00
finders Serialize last_fetched_at as a string with seconds 2014-04-28 12:42:01 +02:00
fixtures Add trailing newline to all text files. 2014-06-21 11:20:22 +02:00
helpers Merge branch 'refator-members-logic' of https://dev.gitlab.org/dzaporozhets/gitlabhq into 7-4-pre 2014-09-17 21:31:41 +03:00
javascripts Add trailing newline to all text files. 2014-06-21 11:20:22 +02:00
lib Add option to gitlab config to specify if LDAP server is active directory. 2014-09-30 12:07:31 +02:00
mailers Update expected value in notify_spec 2014-09-26 14:55:45 -05:00
models Add specs for Repository#last_commit_for_path 2014-09-29 16:45:16 +03:00
requests/api API: Initial support for forking a project via the API 2014-10-01 10:27:48 +02:00
routing Delete wall notes tests 2014-06-13 14:29:26 +03:00
services Add a simple spec test. 2014-09-29 16:07:53 +02:00
support Replace testme with gitlab-test. 2014-09-27 10:11:20 +02:00
tasks/gitlab Make backup version blocker test more robust 2014-02-28 12:11:43 +01:00
workers Fix post-receive specs 2014-09-02 11:05:51 +03:00
factories.rb Fix adminarea and emails for new membership logic 2014-09-15 10:57:02 +03:00
factories_spec.rb Style changes from review with @randx 2013-07-17 22:48:03 -04:00
spec_helper.rb Try wear_merged! without argument 2014-10-01 11:43:16 +03:00