Commit Graph

318 Commits

Author SHA1 Message Date
Dmitriy Zaporozhets 9f10943c1a
Revert "Merge branch 'drop-satellites'"
This reverts commit 957e849f41, reversing
changes made to 6b9dbe9f5a.

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-08-11 10:28:42 +02:00
Dmitriy Zaporozhets b48b07044b
Merge branch 'master' into drop-satellites
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-08-04 16:42:36 +02:00
Dmitriy Zaporozhets c17f5d06aa
Fix merge api and spec
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-08-04 16:33:53 +02:00
Stan Hu 6c9f527b3f Return comments in created order in merge request API
Closes #1832
2015-07-16 22:33:58 -07:00
Dmitriy Zaporozhets a7fded9b95
Huge refactoring for accepting merge requests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-07-16 16:03:07 +02:00
Dmitriy Zaporozhets 342d553709
Rename abilities to correspond contoller/model action names
write_ was renamed to create_
modify_  was renamed to update_

So now in update action we have next code

def create
  can?(current_user, :create_issue, @issue)
end

def update
  can?(current_user, :update_issue, @issue)
end

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-06-26 15:55:56 +02:00
Stan Hu 85145d1d77 Disable changing of the source branch in merge request update API 2015-05-29 09:40:35 -07:00
jubianchi 2c544d43c8 Query issues, merge requests and milestones with their IID through API 2015-05-02 10:44:52 +02:00
Douwe Maan 7e0eb486ed Don't allow a merge request to be merged when its title starts with "WIP". 2015-04-30 15:46:36 +02:00
Douwe Maan 4830b2be5e Refactor GitAccess to use instance variables. 2015-03-24 14:11:48 +01:00
Dmitriy Zaporozhets bdfb349ff7 Refactor and improve sorting objects in API for projects, issues and merge requests 2015-02-05 22:00:54 -08:00
Jeroen van Baarsen b60d06eb2c Added a way to retrieve MR files
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2015-02-04 10:24:25 +01:00
Valery Sizov ab7a79bf3b developer can push to protected branches 2015-01-20 17:34:23 -08:00
Marin Jankovski 8dd672776e Fix failing tests due to updates on the return messages. 2015-01-07 11:39:20 +01:00
Marin Jankovski cd0aed3d54 Add a message when unable to save an object through api. 2015-01-07 10:46:00 +01:00
Dmitriy Zaporozhets d0e3ab5826 Merge branch 'api/improve-error-reporting' of https://github.com/jubianchi/gitlabhq into jubianchi-api/improve-error-reporting 2014-09-23 21:35:45 +03:00
Marin Jankovski 685754b088 Fix typo in comment. 2014-09-16 08:44:50 +02:00
jubianchi 998cd3cb63 Improve error reporting on users API
* users (#6878, #3526, #4209): Validation error messages are now exposed through 400 responses, 409 response are sent in case of duplicate email or username
* MRs (#5335): 409 responses are sent in case of duplicate merge request (source/target branches), 422 responses are sent when submiting MR fo/from unrelated forks
* issues
* labels
* projects
2014-09-16 01:25:24 +02:00
Marin Jankovski b99b2e60d5 Ordering and sorting for MR in api. 2014-09-15 11:54:49 +02:00
Robert Schilling 66f6ca0770 Fix tests after #7526 2014-08-20 20:34:55 +02:00
Robert Schilling cbc90565b5 Do label validation for issues/merge requests API 2014-08-14 10:17:52 +02:00
Dmitriy Zaporozhets d9d8d3b799
Fix old api compatibility and tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-07-30 17:17:29 +03:00
Dmitriy Zaporozhets f8ea52c3a0
Remove thread vars usage from API notes and mr's
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-06-10 17:56:35 +03:00
Dmitriy Zaporozhets 1f1c59b61d Merge pull request #6778 from dblessing/feature/mr_labels
Merge Request Labels
2014-05-13 14:43:46 +03:00
Drew Blessing 5f25cdfe19 Implement Merge Request Labels 2014-05-13 06:41:36 -05:00
Dmitriy Zaporozhets ab032256da
Add some tests for merge API
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-05-13 11:01:40 +03:00
Dmitriy Zaporozhets 5880d7df62
Docs for merge api
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-05-12 18:01:22 +03:00
Dmitriy Zaporozhets 0c73e66643
Specify error codes for merge api
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-05-12 17:51:43 +03:00
Dmitriy Zaporozhets fe6d392236
Draft API method for merge MR
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-05-12 16:34:41 +03:00
Stuart Pook 66209fbc76 Add optional parameter to list merge requests
Add an optional parameter to list merge requests to restrict the
returned merge requests to those that are "opened", "merged" or
"closed". By default all merge requests are returned. Note that
"all" can be given to explicitly request all merge requests.
2014-04-07 16:18:25 +02:00
Dmitriy Zaporozhets 9ee697dd68
Use MergeRequest services in API and controllers
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-04-02 21:51:53 +03:00
Stuart Pook 9886998f24 Add method to get the comments on a merge request
Add method to get the comments for a merge request and
document that you can change the status of a merge request.
2014-03-19 19:07:51 +01:00
Greg Messner 7e14f86c71 Added description parameter support to Create and Update MR API endpoints (issue-110). 2014-03-03 23:08:39 -08:00
Dmitriy Zaporozhets 1c61ac1c64
Refactor MR code reload
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-02-18 20:17:26 +02:00
Dmitriy Zaporozhets 28e13634dc
Merge branch 'improve/mr_diff'
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>

Conflicts:
	features/steps/project/project_fork.rb
	features/steps/project/project_forked_merge_requests.rb
	features/steps/project/project_issue_tracker.rb
	features/steps/project/project_markdown_render.rb
	features/steps/shared/project.rb
2014-01-23 14:38:23 +02:00
Dmitriy Zaporozhets 4b3afe2325
Always create merge_request_diff if MR created
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-01-22 20:22:20 +02:00
skv a3f645ef51 Remove deprecated finders 2014-01-19 23:39:56 +04:00
Angus MacArthur aefe2e952f Fixing unsafe use of Thread.current variable :current_user 2013-10-16 01:20:53 -04:00
Hiroyuki Sato d426195df8 Fix API::MergeRequest
Fixes #5144 Refs #4996
2013-09-22 08:21:22 +09:00
Hiroyuki Sato df9cbbc924 Drop support of root namespace in routing 2013-09-13 07:00:24 +09:00
Izaak Alpert fae3f46615 Refactor merge api create
-Made the api method a little more readable
-removed some missed extra newline's

Change-Id: Ic38baafc813aaeda0a8b283f39916182c8ec37d5
2013-07-17 22:48:03 -04:00
Izaak Alpert 489fa5d726 MR on Fork multiple fixes
-Disable observers post test run
-Allow db:seed_fu RAILS_ENV=test to be run more than once without error
-fix diffs_in_between, was passing in the default_options for grit, but grit in this case doesn't take options, fixed the test to actually fail if the incorrect diffs are returned
-make notes/commits render against proper project
-MR discussion file links should reference note's project
-Added tests for commit links on edit merge request
-fixes edit issues (canceling an edited mr, updating an edited mr)
-updates tests with checks for source code updates
-still forked_merge_requests.feature (project_forked_merge_requests) test not passing (commented out -- "stable" not being set)

MR API: error on bad target_project

-If the target project id is specified and it is not the same as the project the request is being made on (the source), and the it isn't a fork of that project, error out, otherwise use it as the target
-Fixes some busted (but hidden) test cases

Conflicts:
	app/views/merge_requests/show/_diffs.html.haml
	spec/features/notes_on_merge_requests_spec.rb

Change-Id: I20e595c156d0e8a63048baaead7be6330c738a05
2013-07-17 22:42:51 -04:00
Izaak Alpert 3d7194f011 Merge Request on forked projects
The good:

 - You can do a merge request for a forked commit and it will merge properly (i.e. it does work).
 - Push events take into account merge requests on forked projects
 - Tests around merge_actions now present, spinach, and other rspec tests
 - Satellites now clean themselves up rather then recreate

The questionable:

 - Events only know about target projects
 - Project's merge requests only hold on to MR's where they are the target
 - All operations performed in the satellite

The bad:

  -  Duplication between project's repositories and satellites (e.g. commits_between)

(for reference: http://feedback.gitlab.com/forums/176466-general/suggestions/3456722-merge-requests-between-projects-repos)

Fixes:

Make test repos/satellites only create when needed
-Spinach/Rspec now only initialize test directory, and setup stubs (things that are relatively cheap)
-project_with_code, source_project_with_code, and target_project_with_code now create/destroy their repos individually
-fixed remote removal
-How to merge renders properly
-Update emails to show project/branches
-Edit MR doesn't set target branch
-Fix some failures on editing/creating merge requests, added a test
-Added back a test around merge request observer
-Clean up project_transfer_spec, Remove duplicate enable/disable observers
-Ensure satellite lock files are cleaned up, Attempted to add some testing around these as well
-Signifant speed ups for tests
-Update formatting ordering in notes_on_merge_requests
-Remove wiki schema update
Fixes for search/search results
-Search results was using by_project for a list of projects, updated this to use in_projects
-updated search results to reference the correct (target) project
-udpated search results to print both sides of the merge request

Change-Id: I19407990a0950945cc95d62089cbcc6262dab1a8
2013-07-17 22:41:30 -04:00
Dmitriy Zaporozhets 993af5d0d2 cattr_accessor is not threadsafe! 2013-06-11 18:15:18 +03:00
Dmitriy Zaporozhets 634cbd7138 Refactor API classes. So api classes like Gitlab::Issues become API::Issues 2013-05-14 15:33:31 +03:00
Dmitriy Zaporozhets 63e6f055f1 Fix notify specs. Fix merge request close via api 2013-03-28 13:24:01 +02:00
Sebastian Ziebell 3374027e3a Merge branch 'master' into fixes/api, code clean up and tests fixed
Conflicts:
	doc/api/projects.md
	spec/requests/api/projects_spec.rb
2013-03-07 14:51:56 +01:00
Sebastian Ziebell b5ef6d2268 API: refactored and simplified error handling in merge requests API 2013-03-05 23:43:05 +01:00
Sebastian Ziebell 7499f65014 API: extracted helper method to validate required parameters, code clean up
Added a helper method to check if required parameters are given in an API call. Can be used
to return a `400 Bad Request` return code if a required attribute is missing.
Code clean up and fixed tests.
2013-02-27 17:50:30 +01:00
Sebastian Ziebell 3b3add35fb API: merge request documentation updated, added return codes to functions
The API documentation of merge requests contains info to status codes for all functions.
Required arguments are now checked in the merge requests API functions and a `400 Bad Request` error is
returned if they are not given.
2013-02-27 15:07:42 +01:00
Sebastian Ziebell eefb27f5ae Merge branch 'master' into fixes/api
Conflicts:
	spec/requests/api/projects_spec.rb
2013-02-20 12:43:32 +01:00
Andrew8xx8 29f70acc98 Merge Request uses StateMachine now 2013-02-18 14:43:50 +04:00
Sebastian Ziebell 6fc3263e15 API: extracted helper method to provide 400 bad request error with description
Extracted a method for 400 error (Bad request) and adjusted code accordingly. The name of
the missing attribute is used to show which one was missing from the request. It is used to
give an appropriate message in the json response.
2013-02-13 15:48:52 +01:00
Sebastian Ziebell f978a71f41 Creating MR comment without a note returns status code 400 (Bad request)
Creating a comment to an existing merge request via API without providing a note
returns a status code 400 now, suggesting a bad request. The reason for this
is the resource itself (MR) exists but the required property is not set.
2013-02-06 17:02:30 +01:00
Sebastian Ziebell 3f4e215c80 Extracted helper method to avoid code duplication 2013-02-06 17:02:30 +01:00
Sebastian Ziebell 413952ff94 Creating or updating a MR returns more informative status codes.
Using the API library to create or update a merge request at the moment a 404 error is returned.
This is fine when the merge request in question does not exist, but does not provide good
information that for example a required attribute is missing.
A status code of 400 (Bad request) is returned when creating or updating a merge request
when either `source_branch` or `target_branch` is missing. A status code of 409 is returned
when `source_branch` and `target_branch` are the same. Tests are added for these cases.
2013-02-06 16:57:00 +01:00
Riyad Preukschas 8f01190eb5 Remove all references tp the project code parameter from the API 2012-12-21 18:47:04 +01:00
Nihad Abbasov 961cb285b0 API: restore broken merge request commenting 2012-11-29 12:11:01 -08:00
Valeriy Sizov 4281de3640 API: review 2 2012-10-25 13:38:55 +03:00
Valeriy Sizov e6cdfb607a API: tests for merge_requests 2012-10-25 13:13:01 +03:00
Valeriy Sizov 77bc110107 API: help page and comment 2012-10-22 23:09:21 +03:00
Valeriy Sizov 6ffd2f3db6 Changes after review 2012-10-22 23:09:21 +03:00
Valeriy Sizov 93e8d426c5 API: merge request: post comment call 2012-10-22 23:09:21 +03:00
Valeriy Sizov b32a8eea93 API: MergeRequest: authorization 2012-10-22 23:09:21 +03:00
Valeriy Sizov 524b907042 API: MergeRequest refactoring 2012-10-22 23:09:21 +03:00
Valeriy Sizov 5a89934af8 API: update merge request call 2012-10-22 23:09:21 +03:00
Valeriy Sizov fe59547ae5 API: create merge request 2012-10-22 23:09:21 +03:00
Valeriy Sizov bd049e5e7c API:merge request show && list 2012-10-22 23:09:21 +03:00