Commit Graph

318 Commits

Author SHA1 Message Date
Oswaldo Ferreira 96db70a444 Simplify merge_ref_head methods 2019-05-31 19:16:01 -03:00
Oswaldo Ferreira b965009ddd Automatically update MR merge-ref along merge status
This couples the code that transitions the `MergeRequest#merge_status`
and refs/merge-requests/:iid/merge ref update.

In general, instead of directly telling `MergeToRefService` to update
the merge ref, we should rely on `MergeabilityCheckService` to keep
both the merge status and merge ref synced. Now, if the merge_status is
`can_be_merged` it means the merge-ref is also updated to the latest.

We've also updated the logic to be more systematic and less user-based.
2019-05-31 19:16:01 -03:00
Kerri Miller c04ea58350 Revert "Merge branch '55127-add-delay-after-mr-creation-for-async-tasks-to-complete' into 'master'"
This reverts merge request !27978
2019-05-20 17:37:43 +00:00
Kerri Miller 29f9d92642 Confirm existence of head_pipeline if pipeline success required
Pipelines are created by an async worker, so a rapid sequence of API
calls can trigger a state where the pipeline, whose existence is part of
determining if we wait for the pipeline to successfully complete before
merging, can trigger the MR to be immediately merged instead.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/55127
2019-05-07 16:06:53 +00:00
Stan Hu d3fa9c9539 Fix remove_source_branch merge request API handling
Users attempting to set merge requests to `remove_source_branch` to
`false` would encounter an Error 500 because the UpdateService and API
checked `present?`, which would always return `false`. We now just
use `has_key?` to decide whether the parameter is present.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/60530
2019-04-15 11:27:33 -07:00
Oswaldo Ferreira ca884980ee [CE] Support multiple assignees for merge requests
Backports https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/10161
(code out of ee/ folder).
2019-04-08 18:40:00 -03:00
Paul Slaughter 59ac0924da Fix IDE detecting MR from fork branch
**Why?**
Currently the IDE loads a merge request based on only the
`source_branch` name. This means it loads MR's from
forks that have the same branch name (not good).

- This required updating the BE API to accept `source_project_id`
2019-04-05 07:29:53 +00:00
Igor 9745d0de2f Provide EE backports for filtering by approver feature
Adds custom validator for ArrayNoneAny param
Extracts some logic in js into separate files
2019-03-07 23:55:45 +00:00
Igor e779477e8c Revert "Merge branch 'id-1951-filter-merge-requests-by-approvers' into 'master'"
This reverts merge request !24982
2019-03-07 14:59:43 +00:00
Sean McGivern 3781cbe0c3 Merge branch 'sh-optimize-todos-api' into 'master'
Significantly reduce N+1 queries in /api/v4/todos endpoint

Closes #40378

See merge request gitlab-org/gitlab-ce!25711
2019-03-07 10:29:04 +00:00
Igor 572e3f2254 Provide EE backports for filtering by approver feature
Adds custom validator for ArrayNoneAny param
Extracts some logic in js into separate files
2019-03-07 07:06:54 +00:00
Stan Hu 062efe4f7a Significantly reduce N+1 queries in /api/v4/todos endpoint
By preloading associations and batching issuable metadata lookups,
we can significantly cut the number of SQL queries needed to load
the Todos API endpoint.

On GitLab.com, my own tests showed my user's SQL queries went
from 365 to under 60 SQL queries.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/40378
2019-03-06 07:03:46 -08:00
Alexandru Croitor be3578d245 Add array support for labels
* Support label parameter as comma separated and array of strings
for merge requests and issues api endpoints
2019-03-06 13:28:42 +02:00
Mario de la Ossa ee8cb2d1b3 PUT MergeRequest API endpoint - accept labels as an array 2019-03-06 12:56:29 +02:00
Oswaldo Ferreira e8fbc070e0 Add API support for refreshing merge ref path
Add a merge_requests/:iid/merge_to_ref API which make
use of the groundwork to write merge results into
refs/merge-requests/:iid/merge.
2019-02-26 12:37:32 -03:00
Nick Thomas c85a768ca5
Respect the should_remove_source_branch parameter to the merge API 2019-02-25 14:09:48 +00:00
Nermin Vehabovic ff671366cb Added: Include order by ID desc for tie breakers in pagination 2019-02-16 11:03:42 +01:00
Luke Duncalfe b37266004c API support for squash commit message during merge
Issues
https://gitlab.com/gitlab-org/gitlab-ce/issues/47149
https://gitlab.com/gitlab-org/gitlab-ce/issues/56014
2019-02-07 10:05:54 +13:00
Sean McGivern 068b41275f Merge branch 'search-title' into 'master'
Add 'in' filter that modifies scope of 'search' filter  to issues and merge requests API

See merge request gitlab-org/gitlab-ce!24350
2019-02-05 09:52:40 +00:00
Hiroyuki Sato 40198f8184 Fix grammar and spelling 2019-02-05 17:32:27 +09:00
Sam Bigelow c607b35824 Use 'delete' instead of 'remove' for source branch
This is to match `git branch -D <branchname>`
2019-01-22 12:57:01 -05:00
Hiroyuki Sato d32aec06fe Add 'in' filter that modifies scope of 'search' filter to issues and merge requests API 2019-01-14 12:02:55 +09:00
Nick Thomas 93d6f56968 Merge branch 'if-52811-fix_namespaces_api_routing' into 'master'
Fix API::Namespaces routing to accept namepaces with dots

See merge request gitlab-org/gitlab-ce!22912
2018-11-30 15:08:56 +00:00
Nick Thomas 04ceb69f3e
Allow the status of a rebase to be determined 2018-11-28 12:57:47 +00:00
Imre Farkas b1e070bf49
Fix API::Namespaces to accept namepaces with dots
It also renames the API::PROJECT_ENDPOINT_REQUIREMENTS constant to
API::NAMESPACE_OR_PROJECT_REQUIREMENTS
2018-11-28 12:54:11 +01:00
Nick Thomas 9f28729827
Add a rebase API endpoint for merge requests 2018-11-27 18:04:33 +00:00
Douwe Maan 34e8d9726d
Expose {closed,merged}_{at,by} in merge requests API index 2018-11-05 13:49:10 +01:00
Heinrich Lee Yu bf1ed85a9d Refactor api validator to separate class 2018-10-26 10:32:14 +08:00
Heinrich Lee Yu 006631f882 Apply similar change to MRs API 2018-10-26 10:32:14 +08:00
Chantal Rollison 38f3d59fd0 #13650 added wip search functionality and tests 2018-10-03 08:15:00 +00:00
gfyoung 3836d69119 Enable frozen string in lib/api and lib/backup
Partially addresses #47424.

Had to make changes to spec files because
stubbing methods on frozen objects is a mess
in RSpec and leads to failures:

https://github.com/rspec/rspec-mocks/issues/1190
2018-09-29 21:04:50 -07:00
Yorick Peterse 2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00
🙈 jacopo beschi 🙉 20bd1e6b34 Resolve "Return how many commits the source branch is behind the target branch through the API" 2018-09-05 13:07:02 +00:00
Felipe Artur fdb5f285f9 Retrieve merge request closing issues from database cache 2018-08-06 11:58:22 -03:00
Phil Hughes e241fe6b78
added API docs
CHANGELOG
improved comments in API code
improved spec description
2018-07-05 15:44:56 +01:00
Phil Hughes 5428e91374
only include _html fields when asked for 2018-07-05 15:44:54 +01:00
Chantal Rollison c2b622b2a4 Add locked state to merge request API 2018-06-28 07:12:00 -07:00
Robert Speicher 6ced2f1243 Merge branch '42751-rename-mr-maintainer-push' into 'master'
Rephrase Merge Request Maintainer Edit

See merge request gitlab-org/gitlab-ce!19061
2018-06-05 15:04:18 +00:00
Stan Hu bd4bfcc641 Fix N+1 with source projects in merge requests API
Now that we are checking `MergeRequest#for_fork?`, we also need
the source project preloaded for a merge request.
2018-06-03 04:24:23 -07:00
Mark Chao 0d44f4d50e Rephrase "maintainer" to more precise "members who can merge to the target branch"
"Maintainer" will be freed to be used for #42751
2018-06-01 14:33:12 +09:00
Felipe Artur 8ed12efecd Add merge requests list endpoint for groups 2018-05-31 15:29:07 +00:00
blackst0ne 4cff66a6c4 Add 'squash and rebase' feature to CE 2018-05-29 20:51:43 +11:00
Mark Chao d839b880a2 Add created_by_me and assigned_to_me scopes
Deprecate corresponding dash versions created-by-me and assigned-to-me
2018-05-21 09:55:30 +08:00
Bob Van Landuyt 71ccfde322 Correct permissions for creating merge requests from issues
This could only be possible for users that can create merge requests
within a project.

So they need to be a allowed to create a branch and create a merge request.
2018-04-11 10:51:17 +02:00
Bob Van Landuyt 9b27027619 Add documentation for allowing maintainers to push 2018-03-07 16:59:17 +01:00
Bob Van Landuyt 8b2ec23fef Set `allow_maintainer_to_push` using the API 2018-03-07 16:59:17 +01:00
Lin Jen-Shin 156cc98d10 Unify lib/api/merge_requests.rb with EE 2018-03-06 01:44:51 +08:00
Sean McGivern 5a1da682a7 Merge branch '41616-api-issues-between-date' into 'master'
Resolve "API support for selecting only  updated issues before/after a given date"

Closes #41616

See merge request gitlab-org/gitlab-ce!17417
2018-03-05 14:04:35 +00:00
Jacopo 168ff28506 Adds updated_at filter to issues and merge_requests API 2018-03-05 14:10:32 +01:00
haseeb bb89412ffb expose metrics in merge request api 2018-03-02 16:48:55 +00:00
Sean McGivern 2f7dffe548 Add source and target branch filters to merge requests API 2018-03-01 10:41:02 +00:00
Yorick Peterse cca61980d5
Track and act upon the number of executed queries
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.
2018-02-01 17:00:46 +01:00
Sean McGivern 06713cb7b0 Merge branch '39214__pipeline_api' into 'master'
Add `pipelines` endpoint to merge requests API

Closes #39214

See merge request gitlab-org/gitlab-ce!15454
2018-01-11 11:29:53 +00:00
Tony Rom 7ed08fcd5d Fix style 2018-01-10 20:05:34 +03:00
Brent Greeff 34b9cc9674 API: get participants from merge_requests & issues 2018-01-05 15:21:53 +00:00
Mark Fletcher 055543b915 Add optional `search` param for Merge Requests API 2017-12-20 07:23:57 +00:00
Mark Fletcher c9732b3c6d Employ declared_params in finder methods for MR and Issue API lists
- Ensure that unwanted params are no passed to actual finder classes
2017-12-20 07:23:57 +00:00
Tony Rom fd88b0ca56 Add `pipelines` endpoint to merge requests API 2017-12-15 19:53:57 +03:00
George Andrinopoulos 7fb1bb01bd Create issue and merge request destroy services 2017-11-25 22:09:18 +02:00
Sean McGivern 991bf24ec8 Use latest_merge_request_diff association
Compared to the merge_request_diff association:

1. It's simpler to query. The query uses a foreign key to the
   merge_request_diffs table, so no ordering is necessary.
2. It's faster for preloading. The merge_request_diff association has to load
   every diff for the MRs in the set, then discard all but the most recent for
   each. This association means that Rails can just query for N diffs from N
   MRs.
3. It's more complicated to update. This is a bidirectional foreign key, so we
   need to update two tables when adding a diff record. This also means we need
   to handle this as a special case when importing a GitLab project.

There is some juggling with this association in the merge request model:

* `MergeRequest#latest_merge_request_diff` is _always_ the latest diff.
* `MergeRequest#merge_request_diff` reuses
  `MergeRequest#latest_merge_request_diff` unless:
    * Arguments are passed. These are typically to force-reload the association.
    * It doesn't exist. That means we might be trying to implicitly create a
      diff. This only seems to happen in specs.
    * The association is already loaded. This is important for the reasons
      explained in the comment, which I'll reiterate here: if we a) load a
      non-latest diff, then b) get its `merge_request`, then c) get that MR's
      `merge_request_diff`, we should get the diff we loaded in c), even though
      that's not the latest diff.

Basically, `MergeRequest#merge_request_diff` is the latest diff in most cases,
but not quite all.
2017-11-23 12:14:56 +00:00
Mark Fletcher ff1e3a47c4 Fix namespacing for MergeWhenPipelineSucceedsService in MR API 2017-10-30 17:19:51 +00:00
Sean McGivern a68a39e341 Merge branch '18608-lock-issues-v2' into 'master'
Resolve "Lock issue and merge request"

Closes #18608

See merge request gitlab-org/gitlab-ce!14531
2017-10-06 16:47:27 +00:00
Vitaliy @blackst0ne Klachkov c55a9ac4ae Remove 'Repo' prefix from API entites 2017-10-05 19:48:05 +11:00
Luke "Jared" Bennett ff7b545c8e
Merge remote-tracking branch 'origin/master' into 18608-lock-issues 2017-09-20 15:23:00 +01:00
haseeb ff4e81e0ae fix #35290 Make read-only API for public merge requests available without authentication 2017-09-18 17:29:17 +00:00
Jarka Kadlecova 073ba05d31 Support discussion lock in the API 2017-09-14 14:50:32 +02:00
Hiroyuki Sato 7e42711659 Add my_reaction_emoji param to /merge_requests API 2017-09-05 11:56:17 +09:00
Robert Schilling 6a2ee0968e API: Use defined project requirements 2017-08-31 14:57:47 +02:00
Robert Speicher 966b635221 Merge branch '28453-add-time-estimate-time-spent-to-api-issue-output' into 'master'
Add time stats to Issue and Merge Request API

Closes #28453

See merge request !13335
2017-08-30 17:35:14 +00:00
Travis Miller 749c389345 Add time stats to issue and merge request API end points 2017-08-29 08:31:36 -05:00
Robert Schilling e80313f9ee Conditionally destroy a ressource 2017-08-28 16:40:25 +02:00
Robert Schilling 998afa5f74 API: Respect the 'If-Unmodified-Since' for delete endpoints 2017-08-28 16:40:25 +02:00
Toon Claes d77088bb0b Default /merge_request API endpoint to `scope=created-by-me`
This matches the behavior of the /issues endpoint.
2017-07-28 00:07:28 +02:00
Toon Claes d7505de8b3 Add top-level /merge_requests API endpoint
And add support for additional query parameters:
- `author_id`: Returns merge requests created by the given user `id`
- `assignee_id`: Returns merge requests assigned to the given user `id`
- `scope`: Return merge requests for the given scope: `created-by-me`, `assigned-to-me` or `all`
2017-07-27 23:34:57 +02:00
Jarka Kadlecova 7bee7b848a Support both internal and external issue trackers 2017-07-24 08:13:43 +02:00
Dmitriy Zaporozhets 6b8ad689da
Update grape gem
New version of the gem returns 200 status code on delete with content
instead of 204 so we explicitly set status code to keep existing
behavior

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2017-07-20 16:33:18 +03:00
Stan Hu faf9543827 Use view=simple for simplifying merge requests API 2017-07-11 08:02:13 -07:00
Stan Hu e17ac5705d Add a simple mode to merge request API
The current "basic" merge request API still loads too much data. For integrations
like the Trello Power-up, we just need the basics.

Closes #34920
2017-07-11 06:32:13 -07:00
Stan Hu 1f0ee9ca19 Fix sort ordering with merge request API 2017-07-10 15:08:07 -07:00
Stan Hu ef526ff33c Paginate the merge requests API earlier to avoid eager loading every merge request
Fixes a performance regression introduced in !12732
2017-07-10 13:56:46 -07:00
Stan Hu 88c4248ac7 Remove remaining N+1 queries in merge requests API with emojis and labels
Closes #34159
2017-07-08 22:19:34 -07:00
Stan Hu b963d45ca4 Remove many N+1 queries with merge requests API
Identified via `ENABLE_BULLET=1 bundle exec rspec spec/requests/api/merge_requests_spec.rb:34`

Improves speed of #34159
2017-07-07 16:31:21 -07:00
Rémy Coutable 9fe6c2b2c2 Merge branch 'add-since-and-until-params-to-issuables' into 'master'
add created_after and created_before params to issuables

Closes #32901

See merge request !12151
2017-06-19 12:13:27 +00:00
Kyle Bishop ef633d2478 add since and until params to issuables 2017-06-18 15:43:51 -07:00
Felipe Artur c472017078 Fix API bug accepting wrong merge requests parameters 2017-06-16 16:33:09 -03:00
mhasbini ccac05dd90 Fix 404 when upstream has disabled merge requests 2017-04-27 01:04:07 +03:00
Robert Schilling 2ea5d4b7af Ability to filter merge requests by labels and milestones 2017-04-25 22:07:38 +02:00
Chris Wilson e670cb271e Fix updating merge_when_build_succeeds via merge API endpoint
When updating a merge request via the `/merge` endpoint we
check the `mergeable` and `mergeable_state` status, these will return
`false` if the application option only_allow_merge_if_pipeline_succeeds is
enabled. We should skip CI checks if the request uses the
merge_when_pipeline_succeeds param

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/22740
2017-04-24 20:51:05 +10:00
Oswaldo Ferreira fd32960e7c Separate CE params on Grape API 2017-04-10 16:13:48 -03:00
Toon Claes d536d9590b Remove `:id/merge_requests/:merge_request_iid/comments` endpoints
Comments for a merge request should be obtained to the `notes` endpoint.
2017-03-27 10:23:14 +02:00
Rémy Coutable 63360adeae
Add `requirements: { id: %r{[^/]+} }` for all projects and groups namespaced API routes
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-03-16 18:00:24 +01:00
Timothy Andrew 719327112c
API routes referencing a specific merge request should use the MR `iid`
- As opposed to the `id` that was previously being used.
- This brings the API routes closer to the web interface's routes.
- This is specific to API v4.
2017-03-07 13:06:42 +05:30
Adam Niedzielski c727d4328f Remove "subscribed" field from API responses returning list of issues or merge requests 2017-03-06 14:17:07 +01:00
James Lopez a0101ebf84 Update occurrences of MWBS to MWPS
Rename column in the database
 Rename fields related to import/export feature
 Rename API endpoints
 Rename documentation links
 Rename the rest of occurrences in the code
 Replace the images that contain the words "build succeeds" and docs referencing to them
 Make sure pipeline is green and nothing is missing.

updated doc images

renamed only_allow_merge_if_build_succeeds in projects and fixed references

more updates

fix some spec failures

fix rubocop offences

fix v3 api spec

fix MR  specs

fixed issues with partials

fix MR spec

fix alignment

add missing v3 to v4 doc

wip - refactor v3 endpoints

fix specs

fix a few typos

fix project specs

copy entities fully to V3

fix  entity error

more fixes

fix failing specs

fixed missing entities in V3 API

remove comment

updated code based on feedback

typo

fix spec
2017-03-01 12:02:02 +01:00
Robert Schilling 01ea65e0e9 Paginate all endpoints that return an array 2017-02-16 15:32:01 +01:00
James Edwards-Jones 744df2dca8 Update MergeRequest API state_event option documentation 2017-02-09 14:23:49 +00:00
Oswaldo Ferreira c2d64d6702 Remove deprecated MR and Issue endpoints and preserve V3 namespace 2017-02-06 10:12:20 -02:00
Robert Speicher 3a5df1d8fc Merge branch 'fix-api-mr-permissions' into 'security'
Ensure that only privileged users can access merge requests in the API

See merge request !2053
2017-01-23 13:54:35 -05:00
Ruben Davila 0f3c9355c1 Add some API endpoints for time tracking.
New endpoints are:

POST :project_id/(issues|merge_requests)/(:issue_id|:merge_request_id)/time_estimate"

POST :project_id/(issues|merge_requests)/(:issue_id|:merge_request_id)/reset_time_estimate"

POST :project_id/(issues|merge_requests)/(:issue_id|:merge_request_id)/add_spent_time"

POST :project_id/(issues|merge_requests)/(:issue_id|:merge_request_id)/reset_spent_time"

GET  :project_id/(issues|merge_requests)/(:issue_id|:merge_request_id)/time_stats"
2017-01-18 10:48:16 -06:00
Robert Schilling 2cbd07e69c Don't allow blank MR titles in API 2016-12-13 09:01:48 +01:00
Rémy Coutable 192d40e53e Merge branch 'api-remove-source-branch' into 'master'
API: Ability to remove source branch

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/23577

See merge request !7804
2016-12-09 13:39:53 +00:00
Rémy Coutable d134c72523 Merge branch 'use-pagination-helper' into 'master'
Use the pagination helper in the API

See merge request !7920
2016-12-05 12:11:14 +00:00
Robert Schilling 74c8669b0a Use the pagination helper in the API 2016-12-04 18:11:19 +01:00
Robert Schilling 8b5c16e4b1 API: Ability to remove source branch 2016-12-04 16:52:42 +01:00
Grzegorz Bizon 00ca7adca2 Merge branch 'master' into fix/rename-mwbs-to-merge-when-pipeline-succeeds
* master: (110 commits)
  Rewrite an HTTP link to use HTTPS
  Edit /spec/features/profiles/preferences_spec.rb to match changes in 084d90ac
  Add blue back to sub nav active
  Remove JSX/React eslint plugins.
  Fix a transient spec failure
  Adds hoverstates for collapsed Issue/Merge Request sidebar
  Moved groups above projects
  Add StackProf to the Gemfile, along with a utility to get a profile for a spec
  Update Sidekiq-cron to fix compatibility issues with Sidekiq 4.2.1
  Add a CHANGELOG entry
  Alert user when logged in user email is not the same as the invitation
  Expose timestamp in build entity used by serializer
  Rename `MergeRequest#pipeline` to `head_pipeline`
  Remove unnecessary database indexes
  CE-specific changes gitlab-org/gitlab-ee#1137
  Fixing typo & Clarifying Key name
  fix started_at check
  fix blob controller spec failure - updated not to use file-path-
  fix blob controller spec failure
  Merge branch 'jej-use-issuable-finder-instead-of-access-check' into 'security'
  ...

Conflicts:
	app/controllers/projects/merge_requests_controller.rb
	lib/api/merge_requests.rb
	spec/requests/api/merge_requests_spec.rb
2016-11-30 12:21:33 +01:00
Grzegorz Bizon a49e9949c6 Rename `MergeRequest#pipeline` to `head_pipeline` 2016-11-29 14:12:49 +01:00
Douwe Maan 3d7704ae5f Merge branch 'zj-fix-label-creation-non-members' into 'security'
Fix label creation non members

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/23416

See merge request !2006
2016-11-28 21:24:19 -03:00
Grzegorz Bizon 895d97af87 Merge branch 'master' into fix/rename-mwbs-to-merge-when-pipeline-succeeds
* master: (312 commits)
  Fix bad selection on dropdown menu for tags filter
  Fixed issue boards scrolling with a lot of lists & issues
  You can only assign default_branch when editing a project ...
  Don't convert data which already is the target type
  Stop supporting Google and Azure as backup strategies
  renames some of the specs and adds changelog entry
  Fixed dragging issue moving wrong issue after multiple drags of issue
  Fixed issue boards issue sorting when dragging issue into list
  Rephrase some system notes to be compatible with new system note style
  Add missing JIRA file that redirects to the new location
  Fix documentation to create the `pg_trm` extension before creating the DB
  Document that we always use `do...end` for `before` in RSpec
  Backport Note#commands_changes from EE
  Log mv_namespace parameters
  Add default_branch attr to Project API payload in docs.
  Fix title case to sentence case
  properly escape username validation error message flash
  Remove header ids from University docs
  Add missing documentation.
  Added test that checks the correct select box is there for the LFS ...
  ...

Conflicts:
	app/services/system_note_service.rb
	spec/features/merge_requests/merge_when_pipeline_succeeds_spec.rb
	spec/services/merge_requests/merge_when_pipeline_succeeds_service_spec.rb
	spec/services/system_note_service_spec.rb
2016-11-25 11:05:34 +01:00
Rémy Coutable 7902395f1f Merge branch 'fix-api-iid-filter' into 'master'
Fix IID filter for merge requests and milestones

I updated the example in the docs and added a test. The milestones API was also broken for the same reason.

Related to !7358 and !7373

See merge request !7648
2016-11-22 16:16:43 +00:00
Robert Schilling 9e608b41a1 Avoid helper call with default parameters 2016-11-22 11:26:29 +01:00
Robert Schilling cb11d3521c Fix IID filter for merge requests and milestones 2016-11-22 08:25:07 +01:00
Grzegorz Bizon c6a4f9fc5b Update some docs to reflect MWPS name change 2016-11-21 11:27:28 +01:00
Grzegorz Bizon 01f238893a Rename MWBS service to Merge When Pipeline Succeeds 2016-11-21 10:22:09 +01:00
Douglas Barbosa Alexandre 0c052f116c Remove default value for `project` argument on subscribable concern 2016-11-17 15:10:13 -02:00
Robert Schilling 9dbb0417ba Grapify the merge request API 2016-11-15 10:31:18 +01:00
Douglas Barbosa Alexandre 033ea9d1e8 Move label management to services on merge requests API 2016-10-19 14:58:26 -02:00
Douglas Barbosa Alexandre 7e11ca86fd Reuse LabelsFinder on Issueable#add_labels_by_names 2016-10-19 14:58:25 -02:00
Robert Schilling 839aec1a61 Replace parse_boolean with to_boolean 2016-07-20 08:55:44 +02:00
Douwe Maan 6ce25e7b4c Rename MergeRequest methods that return commits or shas to be more clear and consistent 2016-07-06 18:50:58 -04:00
Stan Hu a85dde9182 Fix Error 500 when using closes_issues API with an external issue tracker
Closes #18484
2016-06-11 19:50:08 -07:00
Rémy Coutable 6dff7c1771 Improve initial implementation of the 'only_allow_merge_if_build_succeeds.rb' feature
Based on the feedback from reviewers.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-10 14:36:57 +02:00
Rui Anderson 07dbd6b388 Allow or not merge MR with failed build
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-10 14:36:54 +02:00
Alejandro Rodríguez fade1a4cde Fix pseudo n+1 queries with Note and Note Authors in issuables APIs
This was not a clear cut n+1 query, given that if you're directly subscribed to all issues
that the API is returning you never really need to check for the notes. However, if you're
subscribed to _all_ of them, then for each issuable you need to go once to `notes`, and
once to `users` (for the authors). By preemtively loading notes and authors, at worst you have
1 extra query, and at best you saved 2n extra queries. We also took advantage of this preloading
of notes when counting user notes.
2016-06-08 10:26:05 -04:00
Kamil Trzcinski 8ce1896b46 Merge commit 'ca3c5c295ed653b483fe81c3918ffe60f46666b9' into rename-ci-commit
* commit 'ca3c5c295ed653b483fe81c3918ffe60f46666b9':
  Let contributors know where to start
  Ensure branch cleanup regardless of whether the import process succeeds
  Fix failing todo tests
  Reorder the todos because the use of the project finder attempts to order them differently
  Update target todo test to use a public project
  Use the project finder in the todos finder to limit todos to just ones within projects you have access to.
  Move filtering todos by projects not pending deletion into a scope on the todo model
  Reduce the filters on the todos joins project query by being explicit about the join
  Ensure we don't show TODOS for projects pending delete
  Fix deprecation warnings in spec/services/issues/bulk_update_service_spec.rb
  Remove unused Issuable#is_assigned? method
  fixup! Don't allow merges with new commits
  fixup! Add `sha` parameter to MR accept API
  Reduce Namespace queries in UserReferenceFilter
  Added ReferenceFilter#nodes
  Returning enums in ReferenceFilter#each_node
  Don't allow merges with new commits
  Add `sha` parameter to MR accept API
2016-06-03 15:53:26 +02:00
Sean McGivern 04fdf4b9a9 fixup! Add `sha` parameter to MR accept API 2016-06-02 17:00:16 +01:00
Kamil Trzcinski 021d3810c3 Rename Ci::Commit to Ci::Pipeline and rename some of the ci_commit to pipeline 2016-06-02 16:59:04 +02:00
Sean McGivern d863d86aeb Add `sha` parameter to MR accept API
The `sha` parameter is optional, and when present, must match the
current HEAD SHA of the source branch. Otherwise, the API call fails
with a 409 Conflict and a message containing the current HEAD for the
source branch.

Also tidy up some doc wording.
2016-06-01 20:29:54 +01:00
Ahmad Sherif 0c22698bd4 Add API endpoints for un/subscribing from/to a label
Closes #15638
2016-05-12 22:48:09 +02:00
Robert Schilling fa3009095f Make subscription API more RESTful 2016-04-13 13:52:13 +02:00
Robert Schilling f875189b39 API: Ability to subscribe and unsubscribe from a merge request 2016-04-13 13:45:01 +02:00
Robert Schilling fb2fde9d62 API: Expose subscribed? on issues 2016-04-08 15:53:04 +02:00
Zeger-Jan van de Weg 3b088fc5b5 Minor improvements on IssuableActions 2016-03-21 16:59:35 +01:00
Zeger-Jan van de Weg 1d77822816 minor improvements and fixed specs 2016-03-19 21:24:05 +01:00
Zeger-Jan van de Weg 212e83bab3 Soft delete issuables 2016-03-19 21:23:03 +01:00
Douwe Maan 0807bd5130 Merge branch 'skakirill/gitlab-ce-api-merge-request-setup-milestone' into 'master'
API: Allow to set or update a merge-request's milestone

_Originally opened at !2107 by @ skakirill._

- - -


See merge request !2755
2016-02-12 08:39:18 +00:00
Rémy Coutable b91d1890a8 Pass current_user to merge_request.closes_issues in API ans streamline MR API specs 2016-02-11 09:34:07 +01:00
Gal Schlezinger 78e36780be Added '/api/v3/projects/:id/merge_requests/:merge_request_id/closes_issues' route in the API
Added some documentation for it

Added to changelog

Added curl example and an attribute table

Moved the api route definition from "lib/api/issues.rb" to "lib/api/merge_requests.rb"

Fixed the attributes and changed the documentation to be at "merge_requests.md" too

Changed generic titles to more specific titles

added an underscore

added tests. it depends on a newer version of gitlab-test project
I'm doing a  since I need to add a branch to the `gitlab-test` repo

removed the before

using 'iid' instead of 'id' in the description to reference the issues. that makes the tests pass

Removed the 'closes-issues' key from test_env. so it should pass the tests

Moved the two initializations to the describe block

Changed the changelog
2016-02-11 09:34:07 +01:00
Kirill Skachkov 81f2a9e5b0 API: Allow to set or update a merge-request's milestone 2016-02-08 15:49:35 +01:00
Dmitriy Zaporozhets dfb8803c1c
Improve consistency and duplication for Merge Request API
* Follow REST for merge request API route
* Remove repeating comments API for MR

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-01-28 14:26:12 +01:00
Douwe Maan 097faeb481 Get "Merge when build succeeds" to work when commits were pushed to MR target branch while builds were running 2016-01-05 16:30:03 +01:00
Zeger-Jan van de Weg 0e96d6eb10 Merge branch 'master' into merge-if-green 2015-12-07 10:06:07 +01:00
Dmitriy Zaporozhets 0b68a0e79e
Add API endpoint to fetch merge request commits list
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2015-12-04 11:08:10 +01:00
Zeger-Jan van de Weg a7682f8775 Specs for 'Merge When Build Succeeds' 2015-12-02 13:27:16 +01:00
Zeger-Jan van de Weg 8608c6325e Refactor MergeWhenBuildSucceedsService and incorporate feedback 2015-11-23 10:11:54 +01:00
Zeger-Jan van de Weg 2f048df4a4 API support, incorporated feedback 2015-11-18 11:17:41 +01:00
Dmitriy Zaporozhets 353ddbc795 Merge branch 'stanhu/gitlab-ce-fix-api-mr-comment-notifications' 2015-10-15 15:56:43 +02:00
sue445 a092d27025 [ci skip] Fix wrong comment
According to `attributes_for_keys` and API doc, `POST /projects/:id/merge_requests`
is received `target_project_id` (NOT `target_project`)
2015-10-14 00:36:54 +09:00
Stan Hu 2df573dac3 Fix bug where merge request comments created by API would not trigger notifications
Closes https://github.com/gitlabhq/gitlabhq/issues/9715
2015-10-10 10:59:02 -07:00
Stan Hu 1c289ac0c3 Fix broken sort in merge request API
Closes #2266
2015-09-15 22:55:22 -07:00
Dmitriy Zaporozhets 3e259ea8bc Revert "Merge branch 'revert-satellites' into 'master' "
This reverts commit 5daf44b7c8, reversing
changes made to 2f706fbd23.
2015-08-11 14:33:31 +02:00