summaryrefslogtreecommitdiff
path: root/spec/models/merge_request_spec.rb
Commit message (Collapse)AuthorAgeFilesLines
* adds second batch of tests changed to active tenseactive-tense-test-coveragetiagonbotelho2016-08-091-3/+3
|
* change the API on the merge_request_diff model from diffs -> raw_diffsuse-raw-diffs-for-merge-request-diffsPaco Guzman2016-08-031-2/+2
|
* Make Compare#diffs diff_options a regular argumentDouwe Maan2016-08-031-1/+1
|
* switch from diff_file_collection to diffs20034-safe-diffsPaco Guzman2016-08-031-2/+27
| | | | So we have raw_diffs too
* Move to Gitlab::Diff::FileCollectionPaco Guzman2016-08-031-0/+6
| | | Instead calling diff_collection.count use diff_collection.size which is cache on the diff_collection
* Speedup DiffNote#active? on discussions, preloading noteables and avoid ↵Paco Guzman2016-08-021-0/+24
| | | | | | | | | | | touching git repository to return diff_refs when possible - Preloading noteable we share the same noteable instance when more than one discussion refers to the same noteable. - Any other call to that object that is cached in that object will be for any discussion. - In those cases where merge_request_diff has all the sha stored to build a diff_refs get that diff_refs using directly those sha instead accessing to the git repository to first get the commits and later the sha.
* Fix attr reader to force the intended values for source and target shasDouglas Barbosa Alexandre2016-07-311-3/+15
| | | | | | | | | | | When importing a pull request from GitHub, the old and new branches may no longer actually exist by those names, but we need to recreate the merge request diff with the right source and target shas. We use these `target_branch_sha` and `source_branch_sha` attributes to force these to the intended values. But the reader methods were always looking up to the target/source branch head instead of check if these values was previously set.
* Collapse large diffs by defaultSean McGivern2016-07-081-0/+25
| | | | | When rendering a list of diff files, skip those where the diff is over 10 KB and provide an endpoint to render individually instead.
* Add tests for MergeRequest#reload_diffDouwe Maan2016-07-061-0/+40
|
* Rename MergeRequest methods that return commits or shas to be more clear and ↵Douwe Maan2016-07-061-14/+15
| | | | consistent
* Don't garbage collect commits that have related DB records like commentsDouwe Maan2016-07-041-2/+2
|
* Rename ci_commit -> pipelineRémy Coutable2016-06-101-11/+11
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Rename MergeRequest#cannot_be_merged_because_build_is_not_success? to ↵Rémy Coutable2016-06-101-32/+37
| | | | | | | | #mergeable_ci_state? The logic of the method was obviously inverted. Signed-off-by: Rémy Coutable <remy@rymai.me>
* Improve initial implementation of the ↵Rémy Coutable2016-06-101-16/+47
| | | | | | | | 'only_allow_merge_if_build_succeeds.rb' feature Based on the feedback from reviewers. Signed-off-by: Rémy Coutable <remy@rymai.me>
* Allow or not merge MR with failed buildRui Anderson2016-06-101-0/+117
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Rename all `[ci_]commit` to `[ci_]pipeline` in specs and featuresKamil Trzcinski2016-06-031-1/+1
|
* Fix more places where we should rename ci_commit to pipelineKamil Trzcinski2016-06-031-6/+6
|
* Merge remote-tracking branch 'origin/master' into rename-ci-commitKamil Trzcinski2016-06-031-0/+17
|\
| * Update specs. Add CHANGELOG entryissue-18036Josh Frye2016-06-021-0/+17
| |
* | Rename Ci::Commit to Ci::Pipeline and rename some of the ci_commit to pipelineKamil Trzcinski2016-06-021-2/+2
|/
* Merge branch 'separate-banzai-references' into 'master' Douwe Maan2016-06-011-0/+24
|\ | | | | | | | | | | | | | | | | Separate reference gathering from rendering This is a required step to allow batch processing when gathering references. This in turn would allow grabbing (for example) all mentioned users of an issue/merge request using a single query. cc @rspeicher @DouweM See merge request !3969
| * Refactor ParticipableYorick Peterse2016-06-011-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are several changes to this module: 1. The use of an explicit stack in Participable#participants 2. Proc behaviour has been changed 3. Batch permissions checking == Explicit Stack Participable#participants no longer uses recursion to process "self" and all child objects, instead it uses an Array and processes objects in breadth-first order. This allows us to for example create a single Gitlab::ReferenceExtractor instance and pass this to any Procs. Re-using a ReferenceExtractor removes the need for running potentially many SQL queries every time a Proc is called on a new object. == Proc Behaviour Changed Previously a Proc in Participable was expected to return an Array of User instances. This has been changed and instead it's now expected that a Proc modifies the Gitlab::ReferenceExtractor passed to it. The return value of the Proc is ignored. == Permissions Checking The method Participable#participants uses Ability.users_that_can_read_project to check if the returned users have access to the project of "self" _without_ running multiple SQL queries for every user.
* | Minor changes in note validation specsGrzegorz Bizon2016-05-291-2/+0
| |
* | Update specs to carry out changes in note factoryGrzegorz Bizon2016-05-291-2/+7
|/
* Allows MR authors to have the source branch removed when merging the MRJeroen Jacobs2016-05-201-1/+6
|
* Preserve commits/diff/comments for PRs that were merged on GitHubDouglas Barbosa Alexandre2016-05-131-2/+13
|
* Remove the annotate gem and delete old annotationsJeroen van Baarsen2016-05-091-29/+0
| | | | | | | | | In 8278b763d96ef10c6494409b18b7eb541463af29 the default behaviour of annotation has changes, which was causing a lot of noise in diffs. We decided in #17382 that it is better to get rid of the whole annotate gem, and instead let people look at schema.rb for the columns in a table. Fixes: #17382
* Fix specsKamil Trzcinski2016-04-111-2/+2
|
* Ensuring Merge Request API returns boolean values for work_in_progressAbhi Rao2016-03-281-4/+4
| | | | Fixes #14692
* Soft delete issuablesZeger-Jan van de Weg2016-03-191-0/+5
|
* Merge remote-tracking branch 'origin/master' into remove-wipRémy Coutable2016-03-181-0/+118
|\
| * Add a safeguard in MergeRequest#compute_diverged_commits_countRémy Coutable2016-03-181-0/+22
| | | | | | | | | | We have to ensure source_sha and target_sha are not nil before calling Gitlab::Git::Commit.between.
| * Merge branch 'fix-mr-source-sha' into 'master' Douwe Maan2016-03-181-0/+25
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix MergeRequest#source_sha when there is no diff Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/14170 ### Overview This MR fixes an unhandled Exception when visiting the page of an open Merge Request without diff. ### Description `MergeRequest#source_sha` is expected to return the sha of the source branch last commit. But when an open Merge Request has no diff (e.g. all commits have already been merged to the target branch), `merge_request.source_sha` incorrectly returns `nil`. This was without consequences before – but since !2217 was merged (a few days ago), it makes `Gitlab::Git::Commit.between` raise an "Unexpected nil argument" exception. This can be reproduced when visiting the http://localhost:3000/gitlab-org/gitlab-test/merge_requests/2 page on a fresh local Gitlab setup. This MR fixes the crash, by making sure that `source_sha` returns a correct result even when there is no diff available. I also added tests. @DouweM I believe you wrote most of this code in the first place ; does this looks correct to you, or is there a better way to resolve this issue maybe? See merge request !3135
| | * Fix MergeRequest#source_sha when there is no diffPierre de La Morinerie2016-03-161-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `MergeRequest#source_sha` is expected to return the sha of the source branch last commit. But when a open Merge Request has no diff (e.g. all commits have already been merged to the target branch), `merge_request.source_sha` incorrectly returns `nil`. This was un-noticed before – but now that !2217 has been merged, it makes `Gitlab::Git::Commit.between` raise an "Unexpected nil argument" exception. This fixes the crash, by making sure that `source_sha` returns a correct result even when there is no diff available.
| | * Add tests for MergeRequest#source_shaPierre de La Morinerie2016-03-161-0/+18
| | |
| * | Restrict access to references for confidential issuesDouglas Barbosa Alexandre2016-03-171-0/+1
| |/
| * Use a UNION in MergeRequest.in_projectsYorick Peterse2016-03-111-0/+6
| | | | | | | | | | | | | | | | The OR condition for source_project_id/target_project_id leads to a query plan that performs rather poorly on PostgreSQL due to the use of sub-queries. Because Rails offers no easy alternative for this particular problem we're forced to using a UNION for both conditions. The resulting query performs much faster than just using an OR.
| * Indicate how much an MR branch diverges from the target branchPierre de La Morinerie2016-03-031-0/+64
| |
* | Improve the "easy WIP & un-WIP from link" featureRémy Coutable2016-03-181-18/+10
|/
* Save merge commit id when MR is mergedRubén Dávila2016-02-191-0/+1
|
* Add new data to project in push, issue, merge-request and note webhooks databugagazavr/gitlab-ce-extend-hooksKirill Zaitsev2016-02-111-6/+15
| | | | | | | | | | | - Add `avatar_url`, `description`, `git_ssh_url`, `git_http_url`, `path_with_namespace` and `default_branch` in `project` in push, issue, merge-request and note webhooks data - Deprecate the `ssh_url` in favor of `git_ssh_url` and `http_url` in favor of `git_http_url` in `project` for push, issue, merge-request and note webhooks data - Deprecate the `repository` key in push, issue, merge-request and note webhooks data, use `project` instead
* Merge branch 'disable-remove-source-branch' into 'master' Douwe Maan2016-02-041-1/+7
|\ | | | | | | | | | | | | | | | | | | | | Hide remove source branch button when new commit is added to branch Fixes #3339 This MR hides the 'Remove source branch' button when a new commit is added to the source branch /cc @DouweM See merge request !2701
| * Hide remove source branch button when new commit is added to branchZeger-Jan van de Weg2016-02-041-1/+7
| | | | | | | | | | | | Fixes #3339 This MR hides the 'Remove source branch' button when a new commit is added to the source branch
* | Merge branch 'wipMergeSpacing' into 'master' Douwe Maan2016-02-041-0/+5
|\ \ | |/ |/| | | | | | | | | | | | | | | No space required after WIP identifier Fixes #2426 Currently, the WIP: (or any other variation) prefix of a merge request title must include a trailing space for it to be recognized as a work in progress and prevent merging. To resolve this, I added an or pattern to the regexp to look for any one of the three possible delimiters ':', ']', or ' '. This way the trailing space isn't required but it still won't mark any titles beginning with wip as work in progress (e.g. "Wipwap"). See merge request !1876
| * Removed redundent and incorrect tests on WIPTed Hogan2016-01-061-10/+0
| |
| * Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into wipMergeSpacingTed Hogan2015-12-291-2/+77
| |\
| * | No space required after WIP identifierTed Hogan2015-11-231-0/+15
| | | | | | | | | | | | Modified changelog
* | | Optimize fetching issues closed by a merge requestmerge-request-closes-issues-performanceYorick Peterse2016-02-011-15/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of running ClosingIssueExtractor for every commit in a merge request we can gather all the commit messages (and the merge request description), concatenate all this together and then run ClosingIssueExtractor only once. The result of this is that MergeRequest#closes_issues is now between 3.5x and 4x faster than the old setup. Using a merge request with 10 commits (each referencing a number of issues to close) this reduced the call duration from around 200 milliseconds to around 50 milliseconds. As a result of these changes the Jira related tests for MergeRequest#closes_issues have been removed. These tests stubbed Commit#closes_issues meaning that the only code that was really tested was the call to Array#uniq to filter out duplicate issues. As this code is no longer used (nor present) the corresponding tests were removed. Related: gitlab-org/gitlab-ce#12419
* | | Annotate modelsStan Hu2016-01-061-19/+22
| |/ |/|
* | Backport JIRA serviceDrew Blessing2015-12-181-0/+11
| |