summaryrefslogtreecommitdiff
path: root/lib/api/branches.rb
Commit message (Collapse)AuthorAgeFilesLines
* Track and act upon the number of executed queriesquery-countsYorick Peterse2018-02-011-0/+2
| | | | | | | | | | | This ensures that we have more visibility in the number of SQL queries that are executed in web requests. The current threshold is hardcoded to 100 as we will rarely (maybe once or twice) change it. In production and development we use Sentry if enabled, in the test environment we raise an error. This feature is also only enabled in production/staging when running on GitLab.com as it's not very useful to other users.
* Renamed ProtectedBranches::ApiUpdateService to LegacyApiUpdateServicejej-rename-legacy-protected-branches-api-serviceJames Edwards-Jones2017-11-231-2/+2
|
* Improve performance of the /projects/:id/repository/branches API endpointRémy Coutable2017-11-061-5/+4
| | | | | | Mitigate a N+1 requests to Gitaly problem. Still one left. Signed-off-by: Rémy Coutable <remy@rymai.me>
* Get Project Branch API shows an helpful error message on invalid refnameJacopo2017-10-181-8/+14
| | | | | In API v4 when requesting a branch with an invalid refname shows an helpful error message: 'The branch refname is invalid'.
* Remove 'Repo' prefix from API entitesVitaliy @blackst0ne Klachkov2017-10-051-10/+10
|
* Detect n+1 issues involving GitalyAndrew Newdigate2017-09-191-1/+4
|
* Add branch existence check to the APIv4 branches via HEAD requestblackst0ne2017-09-051-10/+15
|
* Don't use public_send in destroy_conditionally! helperSean McGivern2017-08-301-1/+1
| | | | | As we only override in two places, we could just ask for the value rather than the method name.
* Use commit date for branches and tagsRobert Schilling2017-08-281-4/+11
|
* Extending API for protected branchesEric2017-08-021-2/+4
|
* DRY the branches API requirements definitionRémy Coutable2017-07-271-5/+7
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Fix the /projects/:id/repository/branches endpoint to handle dots in the ↵Rémy Coutable2017-07-271-7/+7
| | | | | | branch name when the project full patch contains a `/` Signed-off-by: Rémy Coutable <remy@rymai.me>
* Enable Style/DotPosition Rubocop :cop:Grzegorz Bizon2017-06-211-4/+4
|
* Allow unauthenticated access to some Branch API GET endpointsRémy Coutable2017-03-201-1/+1
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Add `requirements: { id: %r{[^/]+} }` for all projects and groups namespaced ↵Rémy Coutable2017-03-161-1/+1
| | | | | | API routes Signed-off-by: Rémy Coutable <remy@rymai.me>
* Return 204 for delete endpointsRobert Schilling2017-02-281-5/+1
|
* Return 202 with JSON body on async removals on V4 API3874-correctly-return-json-on-delete-responsesOswaldo2017-02-231-1/+1
|
* Change branch_name param to branch throughout V4 API22132-rename-branch-name-params-to-branchOswaldo Ferreira2017-02-211-3/+3
|
* Paginate all endpoints that return an arrayRobert Schilling2017-02-161-3/+7
|
* Update Rubocop to ruby 2.3zj-drop-ruby-21-testsZ.J. van de Weg2017-02-071-1/+1
|
* Grapify last endpoint of the branches APIgrapify-branch-apiRobert Schilling2017-01-241-6/+1
|
* Allow branch names with dots on API endpointissue_25030Felipe Artur2016-12-081-8/+8
|
* Add button to delete all merged branchesToon Claes2016-11-091-0/+12
| | | | | | | | It adds a button to the branches page that the user can use to delete all the branches that are already merged. This can be used to clean up all the branches that were forgotten to delete while merging MRs. Fixes #21076.
* GrapeDSL for branches endpointszj-grape-branchesZ.J. van de Weg2016-10-311-66/+57
|
* Implement second round of review comments from @DouweM.Timothy Andrew2016-10-241-6/+3
| | | | | | | - Pass `developers_and_merge` and `developers_can_push` in `params` instead of using keyword arguments. - Refactor a slightly complex boolean check to a simple `nil?` check.
* Implement review comments from @DouweM.Timothy Andrew2016-10-241-2/+2
|
* Fix branch protection API.Timothy Andrew2016-10-241-31/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | 1. Previously, we were not removing existing access levels before creating new ones. This is not a problem for EE, but _is_ for CE, since we restrict the number of access levels in CE to 1. 2. The correct approach is: CE -> delete all access levels before updating a protected branch EE -> delete developer access levels if "developers_can_{merge,push}" is switched off 3. The dispatch is performed by checking if a "length: 1" validation is present on the access levels or not. 4. Another source of problems was that we didn't put multiple queries in a transaction. If the `destroy_all` passes, but the `update` fails, we should have a rollback. 5. Modifying the API to provide users direct access to CRUD access levels will make things a lot simpler. 6. Create `create/update` services separately for this API, which perform the necessary data translation, before calling the regular `create/update` services. The translation code was getting too large for the API endpoint itself, so this move makes sense.
* Fix failing tests relating to backporting ee!581.Timothy Andrew2016-08-161-12/+17
| | | | | | | | | | | | | | 1. `GitPushService` was still using `{merge,push}_access_level_attributes` instead of `{merge,push}_access_levels_attributes`. 2. The branches API creates access levels regardless of the state of the `developers_can_{push,merge}` parameters. This is in line with the UI, where Master access is the default for a new protected branch. 3. Use `after(:build)` to create access levels in the `protected_branches` factory, so that `factories_spec` passes. It only builds records, so we need to create access levels on `build` as well.
* Use `Gitlab::Access` to protected branch access levels.Timothy Andrew2016-07-291-9/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | 1. It makes sense to reuse these constants since we had them duplicated in the previous enum implementation. This also simplifies our `check_access` implementation, because we can use `project.team.max_member_access` directly. 2. Use `accepts_nested_attributes_for` to create push/merge access levels. This was a bit fiddly to set up, but this simplifies our code by quite a large amount. We can even get rid of `ProtectedBranches::BaseService`. 3. Move API handling back into the API (previously in `ProtectedBranches::BaseService#translate_api_params`. 4. The protected branch services now return a `ProtectedBranch` rather than `true/false`. 5. Run `load_protected_branches` on-demand in the `create` action, to prevent it being called unneccessarily. 6. "Masters" is pre-selected as the default option for "Allowed to Push" and "Allowed to Merge". 7. These changes were based on a review from @rymai in !5081.
* Have the `branches` API work with the new protected branches data model.Timothy Andrew2016-07-291-12/+17
| | | | | | | | | | | | 1. The new data model moves from `developers_can_{push,merge}` to `allowed_to_{push,merge}`. 2. The API interface has not been changed. It still accepts `developers_can_push` and `developers_can_merge` as options. These attributes are inferred from the new data model. 3. Modify the protected branch create/update services to translate from the API interface to our current data model.
* Simplify entities for branches and tags APIapi-cleanup-entitiesRobert Schilling2016-07-191-5/+7
|
* Only update onceRobert Schilling2016-07-191-2/+3
|
* API: Expose 'developers_can_merge' for branchesRobert Schilling2016-07-191-1/+5
|
* API: Expose 'developers_can_push' for branchesRobert Schilling2016-07-191-2/+10
|
* Enable Style/EmptyLines cop, remove redundant onesrubocop/enable-cops-for-empty-linesGrzegorz Bizon2016-07-011-2/+0
|
* Ensure that branch and tag names are given in APIrefactor-tags-branches-apiRobert Schilling2016-06-301-4/+4
|
* Changed the argument of not_found for 'unprotect'Yasser Hussain2016-04-061-1/+1
| | | | | not_found appends string "Not Found" to the argument causing the resulting message to be "Branch does not exist Not Found" which is an incorrect error message. Changed the argument of not_found! for 'unprotect' command to "Branch" from "Branch does not exist". This makes the final error message to appear as "Branch Not Found" which is correct and same as error messages for other commands like 'protect'.
* Added the missing commaDan Tudor2015-03-311-1/+1
|
* Allow ability to delete branches with '/` in nameDan Tudor2015-03-251-3/+3
|
* Unescape branch param to deleteDan Tudor2015-03-241-1/+2
| | | | Branch names that contain `/` return a 405 error when being deleted because the slash is escaped to `%2F` This patch will unescape the param prior to executing the delete action.
* Update branch api not found messages to 'Branch not found'.Marin Jankovski2014-12-301-4/+5
|
* API delete branch: render branch name json instead of trueDmitriy Zaporozhets2014-10-301-1/+4
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Fix branch APIDmitriy Zaporozhets2014-09-251-2/+2
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Factor error and success methods from services.Ciro Santilli2014-09-211-6/+5
|
* Validate branch-names and references in WebUI, APIRobert Schilling2014-09-031-4/+12
| | | | Add specs for GitRefValidator
* Improve branch deletion via APIDmitriy Zaporozhets2014-05-231-1/+7
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Api call to remove branchDmitriy Zaporozhets2014-05-221-0/+12
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Add fix for API when branch names have periods in them. Relates to issue ↵Sean Edge2014-05-081-3/+7
| | | | #6128 (https://github.com/gitlabhq/gitlabhq/issues/6128).
* Create branch via APIDmitriy Zaporozhets2014-04-011-0/+15
| | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* Move branches api to separate classDmitriy Zaporozhets2014-03-311-0/+70
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>