Commit Graph

468 Commits

Author SHA1 Message Date
Douwe Maan 095fcfc447 Merge branch 'mc-ui'
# Conflicts:
#	app/controllers/projects/merge_requests_controller.rb
2016-08-17 12:21:30 -05:00
Douwe Maan 4a13aa9f34 Store discussion_id on Note for faster discussion lookup. 2016-08-17 12:16:46 -05:00
Connor Shea 1d3aa59f99
Merge branch 'master' into diff-line-comment-vuejs 2016-08-16 16:59:19 -06:00
Kamil Trzcinski a2bf638e40 Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into 18681-pipelines-merge-request 2016-08-16 15:51:41 +02:00
Lin Jen-Shin 11f840bfa5 An empty line after guard, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5142#note_13904931
2016-08-16 21:04:06 +08:00
Douwe Maan 1ba2ef4fda Merge branch 'master' into mc-ui 2016-08-15 17:20:56 -05:00
Lin Jen-Shin 567ef6c175 Merge remote-tracking branch 'upstream/master' into artifacts-from-ref-and-build-name
* upstream/master: (123 commits)
  Limit the size of SVGs when viewing them as blobs
  Add a spec for ProjectsFinder project_ids_relation option
  Fix ProjectsFinder spec
  Pass project IDs relation to ProjectsFinder instead of using a block
  Speed up todos queries by limiting the projects set we join with
  Used phantomjs variable
  Ability to specify branches for pivotal tracker integration
  Fix a memory leak caused by Banzai::Filter::SanitizationFilter
  Update phantomjs link
  Remove sleeping and replace escaped text.
  Filters test fix
  Fixed filtering tests
  Removed screenshot command 💩
  Updated failing tests
  Used mirrored version on GitLab
  Updated tests
  Fix `U2fSpec` for PhantomJS versions > 2.
  Fix file downloading
  Install latest stable phantomjs
  Use new PhantomJS version
  ...
2016-08-16 00:14:26 +08:00
Douwe Maan 06e3bb9f23 Merge branch 'zj-deployment-status-on-mr' into 'master'
Show deployment status on a MR view

## What are the relevant issue numbers?

Resolves #19571, one in the list of #19992

## Screenshots (if relevant)

external_url = nil
![Screen_Shot_2016-08-02_at_13.57.03](/uploads/20ea1587eea556c7a1acd0ff726a5bfb/Screen_Shot_2016-08-02_at_13.57.03.png)

external_url != nil
![Screen_Shot_2016-08-02_at_13.59.59](/uploads/0094b9ddece3f4bf76c83988840c096d/Screen_Shot_2016-08-02_at_13.59.59.png)

Note, the timings are weird between merging and deploying, that is because I did it in the wrong order.

## Does this MR meet the acceptance criteria?

- [X] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- Tests
  - [x] Added for this feature/bug
  - [x] All builds are passing

See merge request !5622
2016-08-15 15:29:26 +00:00
Dmitriy Zaporozhets 49d63dc131
Fix and refactor merge request diff_refs method
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-15 18:11:18 +03:00
Dmitriy Zaporozhets 643a368fa4
Make merge request diff works with new FileCollection logic
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-15 17:57:19 +03:00
Dmitriy Zaporozhets 5e95c0b8d2
Merge branch 'master' into dz-merge-request-version
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-15 17:27:22 +03:00
Dmitriy Zaporozhets 29ac60d7fb
Change the way old merge request diff handled
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-15 15:20:36 +03:00
Douwe Maan c770201061 Merge branch 'master' into diff-line-comment-vuejs 2016-08-12 17:23:19 -05:00
Douwe Maan e257200459 Add specs for NotesController and DiscussionsController 2016-08-12 16:24:09 -05:00
Douwe Maan 9eca67c950 Verify user is signed in and can actually resolve conflicts 2016-08-12 23:24:50 +03:00
Douwe Maan cf4cbb018e Rename `can_resolve_conflicts_in_ui?` to `conflicts_can_be_resolved_in_ui?` 2016-08-12 23:24:50 +03:00
Sean McGivern 427e724698 Don't allow resolving invalid conflicts
An MR can only be resolved in the UI if:
- It has conflicts.
- It has valid diff_refs (in other words, it supports new diff notes).
- It has no conflicts with one side missing.
- It has no conflicts in binary files.
- It has no conflicts in files too large to display.
- It has no conflicts containing invalid conflict markers.
2016-08-12 23:24:48 +03:00
Sean McGivern 28ef06c52b Fix merge conflict reading for new diffs 2016-08-12 23:24:43 +03:00
Kamil Trzcinski cae0fa7cba Properly select a list of Pipelines for a Merge Requests 2016-08-12 16:22:48 +02:00
Z.J. van de Weg 07fc2f852a Method names changed to #includes_commit? 2016-08-12 10:43:04 +02:00
Z.J. van de Weg b497b0ce3f Incorporate feedback 2016-08-11 21:29:57 +02:00
Z.J. van de Weg 49f72e705f Show deployment status on a MR view 2016-08-11 21:29:57 +02:00
Scott Le 6109daf480 api for generating new merge request
DRY code + fix rubocop

Add more test cases

Append to changelog

DRY changes list

find_url service for merge_requests

use GET for getting merge request links

remove files

rename to get_url_service

reduce loop

add test case for cross project

refactor tiny thing

update changelog
2016-08-11 23:37:00 +07:00
Lin Jen-Shin 4b559c9afb Reverse ref and sha in args and rename pipeline to pipeline_for 2016-08-11 17:26:04 +08:00
Dmitriy Zaporozhets d99d5198c2
Add MergeRequest#branch_merge_base_commit method
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-08 23:00:11 +03:00
Douwe Maan 538e66d71c Merge branch 'master' into diff-line-comment-vuejs
# Conflicts:
#	app/models/discussion.rb
#	db/schema.rb
2016-08-03 15:32:00 -07:00
Paco Guzman 631f59d4e7 change the API on the merge_request_diff model from diffs -> raw_diffs 2016-08-03 23:32:12 +02:00
Douwe Maan c008a1a967 Make Compare#diffs diff_options a regular argument 2016-08-03 09:32:01 -07:00
Paco Guzman c86c1905b5 switch from diff_file_collection to diffs
So we have raw_diffs too
2016-08-03 07:00:20 +02:00
Paco Guzman 1d0c7b7492 Introduce Compare model in the codebase.
This object will manage Gitlab::Git::Compare instances
2016-08-03 07:00:20 +02:00
Paco Guzman 8f359ea917 Move to Gitlab::Diff::FileCollection
Instead calling diff_collection.count use diff_collection.size which is cache on the diff_collection
2016-08-03 07:00:20 +02:00
Paco Guzman cd7c2cb6dd Cache highlighted diff lines for merge requests
Introducing the concept of SafeDiffs which relates 
diffs with UI highlighting.
2016-08-03 07:00:19 +02:00
Dmitriy Zaporozhets fc8d2fbc94
Build diff_refs for merge request if merge request diff does not exist
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-02 17:52:20 +03:00
Paco Guzman 8716ff7f63 Speedup DiffNote#active? on discussions, preloading noteables and avoid 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.
2016-08-02 16:04:15 +02:00
Dmitriy Zaporozhets 7cb8ceb5b9
Fix creation and reload of the merge request diff
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-02 16:28:37 +03:00
Dmitriy Zaporozhets 6515ec09bb
Chnage the way how merge request diff is initialized and saved
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-02 15:38:03 +03:00
Dmitriy Zaporozhets f8aeb8cdac Change merge request diff creation from callback to part of the service
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-02 13:31:19 +03:00
Dmitriy Zaporozhets 3c1dca0301 Add more tests to merge_request_diff and improve initialize
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-02 13:31:19 +03:00
Dmitriy Zaporozhets b0a023842d Reload merge request association reload when update code
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-02 13:31:19 +03:00
Dmitriy Zaporozhets 964742f600 Ensure merge request is created with valid diff object
* Add merge_request_diff validation to merge_request model
* Improve initialize of merge_request_diff object
* Rename some merge_request_diff methods for clarity

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-02 13:31:19 +03:00
Dmitriy Zaporozhets 94ca25c9b8 Improve merge request diff creation and update tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-02 13:31:19 +03:00
Dmitriy Zaporozhets ceff810643 Create merge request diff on merge request creation
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-02 13:31:19 +03:00
Dmitriy Zaporozhets 2afcc9e910 Create new version of merge request diff on push instead of updating existing one
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-08-02 13:31:19 +03:00
Douglas Barbosa Alexandre 285ba1b20f fixup! Fix attr reader to force the intended values for source and target shas 2016-07-31 19:45:30 -03:00
Douglas Barbosa Alexandre 5b4ceeed63 Fix attr reader to force the intended values for source and target shas
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.
2016-07-31 19:45:30 -03:00
Douwe Maan d9a949c17c Use correct user for 'Discussion resolved by...' 2016-07-28 21:14:45 -06:00
Douwe Maan fa4a613517 Add 'Resolved all discussions' system note 2016-07-28 20:39:35 -06:00
Douwe Maan eeb41c759e Add endpoints to resolve diff notes and discussions 2016-07-25 22:45:23 -06:00
Rémy Coutable 2cf7f09b1e
Revert "Revert "Merge branch '18193-developers-can-merge' into 'master' ""
This reverts commit 530f5158e2.

See !4892.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-07-18 10:16:56 +02:00
Robert Speicher 530f5158e2 Revert "Merge branch '18193-developers-can-merge' into 'master' "
This reverts commit 9ca633eb4c, reversing
changes made to fb229bbf79.
2016-07-13 13:57:30 -05:00
Timothy Andrew af7e75162e Don't ask the user to "merge this request manually".
1. If they are a developer with "Developers can Merge" switched on.
2016-07-13 13:24:56 +05:30
Timothy Andrew 60245bbe22 Refactor `Gitlab::GitAccess`
1. Don't use case statements for dispatch anymore. This leads to a lot
   of duplication, and makes the logic harder to follow.

2. Remove duplicated logic.

    - For example, the `can_push_to_branch?` exists, but we also have a
      different way of checking the same condition within `change_access_check`.

    - This kind of duplication is removed, and the `can_push_to_branch?`
      method is used in both places.

3. Move checks returning true/false to `UserAccess`.

    - All public methods in `GitAccess` now return an instance of
      `GitAccessStatus`. Previously, some methods would return
      true/false as well, which was confusing.

    - It makes sense for these kinds of checks to be at the level of a
      user, so the `UserAccess` class was repurposed for this. The prior
      `UserAccess.allowed?` classmethod is converted into an instance
      method.

    - All external uses of these checks have been migrated to use the
      `UserAccess` class

4. Move the "change_access_check" into a separate class.

    - Create the `GitAccess::ChangeAccessCheck` class to run these
      checks, which are quite substantial.

    - `ChangeAccessCheck` returns an instance of `GitAccessStatus` as
      well.

5. Break out the boolean logic in `ChangeAccessCheck` into `if/else`
   chains - this seems more readable.

6. I can understand that this might look like overkill for !4892, but I
   think this is a good opportunity to clean it up.

    - http://martinfowler.com/bliki/OpportunisticRefactoring.html
2016-07-13 13:24:56 +05:30
Mathias Vestergaard f0577d8385 Added "developers can merge" setting to protected branches
- Cherry-picked from `mvestergaard:branch-protection-dev-merge`
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4220
2016-07-13 13:24:26 +05:30
Sean McGivern 79a47582e8 Merge branch 'master' into single-file-diffs 2016-07-11 09:38:11 +01:00
Paco Guzman 52a89f2022 Memoize MR merged/closed events retrieval 2016-07-08 12:35:42 +02:00
Sean McGivern b6b26692ea Collapse large diffs by default
When rendering a list of diff files, skip those where the diff is over
10 KB and provide an endpoint to render individually instead.
2016-07-08 10:56:55 +01:00
Douwe Maan ac26b23712 Remove duplication, unused methods, and some other style things 2016-07-06 19:29:41 -04:00
Douwe Maan 228d2a4cb1 Add some more code comments. 2016-07-06 19:28:13 -04:00
Douwe Maan 710c488691 Automatically update diff note positions when MR is pushed to 2016-07-06 18:51:00 -04:00
Douwe Maan 8d7dc26d39 Support new diff notes on MRs with diff_refs 2016-07-06 18:51:00 -04:00
Douwe Maan 17ab745e40 Add Timeless helper module to prevent updated_at from being updated 2016-07-06 18:50:58 -04:00
Douwe Maan a9fa45f09e Represent DiffRefs as proper class instead of tuple array 2016-07-06 18:50:58 -04: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
Patricio Cano be221a30ac Revert back to not defining a default Git access protocol. 2016-07-05 16:54:22 -05:00
Patricio Cano 29c50c5315 Default Git access protocol to `web` 2016-07-05 16:54:22 -05:00
Patricio Cano 8b14d1d2c2 Rename ENV['PROTOCOL'] to ENV['GL_PROTOCOL'] to conform to what GitLab Shell expects and make the `protocol` param in `GitAccess` mandatory. 2016-07-05 16:54:22 -05:00
Douwe Maan 3286dd7a1d Don't garbage collect commits that have related DB records like comments 2016-07-04 00:11:33 -04:00
James Lopez f29c30475e use has_many relationship with events 2016-07-01 15:34:10 +02:00
James Lopez 3d2a736679 fixing events for import/export 2016-06-29 10:35:26 +02:00
Z.J. van de Weg c31f876a27 Workhorse to serve email diffs
Depends on the changes in Workhorse (gitlab-org/gitlab-workhorse!48).
2016-06-28 14:26:38 +02:00
Rémy Coutable e3d464d82a
Fix a wrong MR status when merge_when_build_succeeds & project.only_allow_merge_if_build_succeeds are true
The issue was that `MergeRequest#mergeable?` returns false when the CI
state is not success and project.only_allow_merge_if_build_succeeds is
true. In this case `Projects::MergeRequestsController#merge` would
return the `:failed` status when enabling `merge_when_build_succeeds`,
thus leading to a weird state and the MR never automatically merged.

The fix is to disable the CI state check in the controller safeguard
that early return the `:failed` status.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-24 18:33:02 +02:00
Stan Hu 7c9eba8919 Fix RangeError exceptions when referring to issues or merge requests outside of max database values
When using #XYZ in Markdown text, if XYZ exceeds the maximum value of a signed 32-bit integer, we
get an exception when the Markdown render attempts to run `where(iids: XYZ)`. Introduce a method
that will throw out out-of-bounds values.

Closes #18777
2016-06-18 13:07:38 -07:00
James Lopez ad68bc63b5 Merge branches 'feature/project-export' and 'feature/project-import' of gitlab.com:gitlab-org/gitlab-ce into feature/project-import
# Conflicts:
#	app/models/project.rb
#	db/schema.rb
#	lib/gitlab/import_export/import_export_reader.rb
2016-06-13 12:43:25 +02:00
Rémy Coutable a1db70770e Remove unused MergeRequest#gitlab_merge_status method
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-10 18:42:03 +02:00
Rémy Coutable 3579edba1f
Rename ci_commit -> pipeline
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-10 14:41:38 +02:00
Rémy Coutable 5324c93643 Rename MergeRequest#cannot_be_merged_because_build_is_not_success? to #mergeable_ci_state?
The logic of the method was obviously inverted.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-10 14:37:32 +02: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
Jacob Vosmaer (GitLab) afa21054fa Merge branch 'zj-workhorse-to-serve-diffs' into 'master'
Workhorse to serve raw diffs

Fixes (partially) #13999

Dependent on: gitlab-org/gitlab-workhorse!45

See merge request !4130
2016-06-07 12:50:29 +00:00
Zeger-Jan van de Weg 01e1139f68 Workhorse to serve raw diffs 2016-06-03 18:43:22 +02: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
James Lopez 7c8359b744 started refactoring some stuff based on MR feedback 2016-06-01 18:03:51 +02:00
Jeroen Jacobs 7880a300dc Allows MR authors to have the source branch removed when merging the MR 2016-05-20 11:30:03 +02:00
Douglas Barbosa Alexandre 7e1f14e215 Preserve commits/diff/comments for PRs that were merged on GitHub 2016-05-13 17:55:42 -05:00
Robert Speicher 4735a75340 Merge branch 'deprecated-class-methods-cop' into 'master'
Enable the Rubocop DeprecatedClassMethods cop

This reports uses of `File.exists?` and `Dir.exists?`, which were both
deprecated in Ruby and will eventually be removed in favor of `.exist?`.
Also fixes all existing uses of the deprecated methods.

See merge request !4087
2016-05-12 22:41:01 +00:00
James Lopez 47cd14b560 Merge branch 'feature/project-export' of gitlab.com:gitlab-org/gitlab-ce into feature/project-import 2016-05-09 18:01:06 +02:00
Jeroen van Baarsen f1479b56b7
Remove the annotate gem and delete old annotations
In 8278b763d9 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
2016-05-09 18:00:28 +02:00
Connor Shea 9cc0937b3a Enable the Rubocop DeprecatedClassMethods cop
This reports uses of `File.exists?` and `Dir.exists?`, which were both
deprecated in Ruby and will eventually be removed in favor of
`.exist?`. Also fixes all existing uses of the deprecated methods.
2016-05-08 15:33:34 -06:00
Zeger-Jan van de Weg 47da013cf8 Annotate the models 2016-05-06 08:27:46 +02:00
James Lopez 7614d230a2 fix conflicts 2016-04-21 17:28:56 +02:00
Kamil Trzciński d240666800 Merge branch 'ci-commit-as-pipeline' into 'master'
Ci::Commit becomes a Pipeline object

1. Ci::Commit receives context: ref, :tag.
1. One Ci::Commit describes a one Pipeline
1. Pipeline is created from `.gitlab-ci.yml`
1. Pipeline is a ordered group of builds
1. We test MR against Pipeline
1. Pipelines have a separate view (https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3703)
1. Pipeline can be triggered from UI (https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3703)
1. Later we change `Trigger -> TriggerRequest -> Build` to `Trigger -> Pipeline` (future)
1. We add a Pipeline Hook that will be triggered on Pipeline status change  (future)
1. We extend notifications to use `Pipeline Hook` to send summary on pipeline changes (future)

After merging that I'll prepare a separate MR that will unify naming, database columns, table names:
```
Ci::Commit -> Pipeline
Ci::Build -> Build
CommitStatus -> Job
GenericCommitStatus -> ExternalJob

ci_commits -> pipelines
ci_builds -> jobs
```

This MR implements first 5 points.

This is made to solve this issue https://gitlab.com/gitlab-org/gitlab-ce/issues/14149.

See merge request !3653
2016-04-21 08:10:37 +00:00
Douwe Maan d00e5455ee Verify the MR being displayed question has a merge commit set and can be cherry-picked 2016-04-20 14:28:19 +02:00
Rémy Coutable 6970612bcc
Get rid of more requires, which causes warnings when code is reloaded
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-04-19 11:48:10 +02:00
Kamil Trzcinski 4af0968c43 Merge remote-tracking branch 'origin/master' into ci-commit-as-pipeline 2016-04-13 15:47:18 +02:00
Felipe Artur a64f1c7636 Add changelog entry, improve specs and model code 2016-04-12 15:52:03 -03:00
Felipe Artur 476cf23fc3 Allow to close invalid merge request 2016-04-11 19:00:59 -03:00
Kamil Trzcinski 5d69f5b46d Use Ci::Commit as Pipeline 2016-04-11 23:32:54 +02:00
James Lopez d29c816dfe Merge branch 'feature/project-export' of gitlab.com:gitlab-org/gitlab-ce into feature/project-import 2016-04-08 16:04:59 +02:00
Douwe Maan f505c753b0 Merge branch 'fix_remove_fork_link' into 'master'
Remove fork link closes all merge requests opened on source project

Currently, if you:

- create a fork
- open a merge request on the source project
- remove the fork link

The created MR cannot be closed.

With this MR, all pending MR is closed when the fork link is removed.

See merge request !3189
2016-04-04 15:37:08 +00:00
Yorick Peterse e7849b0b25 Memoize reference_pattern/link_reference_pattern
These methods are called quite often in loops so by memoizing their
output we can reduce timings a bit.
2016-04-01 11:13:30 +02:00
Gabriel Mazetto 11865ee267 We need `sha` reference from `diff_base_commit` to generate the diff 2016-03-29 23:59:51 -03:00
Gabriel Mazetto a9b2a2744c Use `diff_base_commit` instead of `target_branch` to generate diffs 2016-03-29 23:59:51 -03:00
Abhi Rao 762d6ab4fd Ensuring Merge Request API returns boolean values for work_in_progress
Fixes #14692
2016-03-28 22:11:44 -05:00
James Lopez b0f34fb091 Merge branches 'feature/project-import' and 'master' of gitlab.com:gitlab-org/gitlab-ce into feature/project-import 2016-03-21 09:14:24 +01:00
Douwe Maan fd8d44ca61 Fix group project selection in IssuableFinder 2016-03-20 21:14:39 +01:00
Rémy Coutable cafa408b25 Merge remote-tracking branch 'origin/master' into remove-wip 2016-03-18 23:29:18 +01:00
Rémy Coutable 0b942541da Improve the "easy WIP & un-WIP from link" feature 2016-03-18 23:27:35 +01:00
Rémy Coutable bc92de8f03 Add a safeguard in MergeRequest#compute_diverged_commits_count
We have to ensure source_sha and target_sha are not nil before calling
Gitlab::Git::Commit.between.
2016-03-18 19:01:20 +01:00
Pierre de La Morinerie 18295585d9 Fix MergeRequest#source_sha when there is no diff
`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.
2016-03-16 14:02:04 +01:00
Baldinof 436caf4e8b Merge branch 'master' into fix_remove_fork_link 2016-03-14 21:51:06 +01:00
James Lopez 25e078c114 Merge branches 'feature/project-export' and 'feature/project-import' of gitlab.com:gitlab-org/gitlab-ce into feature/project-import 2016-03-14 12:32:46 +01:00
James Lopez 37c68fe025 don't create MR diff as this can be imported presumably 2016-03-14 11:12:00 +01:00
James Lopez 3a131383b6 fixed MR issue and refactored some stuff 2016-03-14 10:35:41 +01:00
Baldinof e8c723543c Close merge requests when removing fork relation 2016-03-11 21:37:57 +01:00
Yorick Peterse 4f3fa519c6 Use a UNION in MergeRequest.in_projects
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.
2016-03-11 15:26:32 -05:00
James Lopez 76efdea788 fixing MR issues with import 2016-03-11 18:17:57 +01:00
Douwe Maan 903aa7c95e Merge branch 'issue_13621_2' into 'master'
Labels should be visible in dashboard and group milestone views

Closes #13621

See merge request !2931
2016-03-07 17:18:25 +00:00
Douwe Maan d43c778402 Merge branch 'indicate-mr-diverged-from-target' into 'master'
Indicate when an MR diverged from the target branch

This adds an indicator to the "Merge MR" box, to tell if and how much an MR diverged from its target branch.

For instance, consider an MR to merge the branch `feature` into `master`. Some other commits were added to `master` since `feature` was created, and the two branches diverged.

```text
o master
|
o    o feature
|    |
o    o
|  /
o
```

In this case, there will be a label in the MR Merge box stating:

> This MR is by 3 commits behind the target branch `master`.

## Screenshots

### The branch diverged from the target (UI Proposal)

![UI_suggestion_1](/uploads/cd5bee3959e68026ec7d5097259d53f4/UI_suggestion_1.png)

### The branch diverged from the target (alternative UI Proposal)

![UI_suggestion_2](/uploads/f36977101b59a610850e129837dfbc83/UI_suggestion_2.png)

## How is this useful?

- In a _rebase-workflow_ (MR are preferably rebased before being merged), the reviewer wants to know if an MR is rebased on the target branch before merging it. 
    
    _With this indicator, the reviewer knows immediately if the branch is rebased, or if she needs to ask the committer to rebase its branch._

<br>

- To keep the git history readable, a team prefers to avoid merging branches that really lag a lot behind the target branch. Merging an MR that is 10 commits behind is fine, but 200 is too much.

    _With this indicator, the reviewer can see on the MR page if the branch is really far behind the target – or only a few commits behind._

## Open questions

We've been using this at @captaintrain for a few months now, and found it quite useful.

I guess the open-questions are mostly: what UI would be the more adequate? Any thoughts on this, on the general usefulness and/or on the code?

See merge request !2217
2016-03-07 09:01:26 +00:00
Rubén Dávila 95b06a62c0 Updates from last code review. 2016-03-06 23:07:19 -05:00
Rubén Dávila a056dfa9a0 Refactor GlobalMilestone queries.
Make methods return ActiveRecord Relations instead of Arrays.
2016-03-04 22:37:03 -05:00
Jacob Schatz 2feb9eb1f0 Change icons for open close on issue/MR
Button full width on phone on MR/issue.
2016-03-04 09:06:57 -05:00
Jacob Vosmaer 1764e1b7cb Use Gitlab::Git::DiffCollections 2016-03-03 18:38:44 +01:00
Pierre de La Morinerie 543845f7ef Indicate how much an MR branch diverges from the target branch 2016-03-03 15:11:44 +01:00
Douwe Maan acf9778e77 Use specialized system notes when MR is (un)marked as WIP 2016-02-26 19:34:14 -08:00
Rubén Dávila 5ef3f80d41 More updates from the last code review. 2016-02-19 13:15:42 -05:00
Rubén Dávila d34733efc4 Don't show revert button if commit/MR has already been reverted. 2016-02-19 13:14:54 -05:00
Rubén Dávila 38752d159d Remove no longer required methods on MR. 2016-02-19 13:14:52 -05:00
Rubén Dávila b6fe51b901 Some updates from last code review. 2016-02-19 13:14:50 -05:00
Rubén Dávila df5f362c34 Add some specs plus some refactor. 2016-02-19 13:14:50 -05:00
Rubén Dávila 0b7d70a35e Use #iid for revert branch name so it's consistent when the MR id in the URL. 2016-02-19 13:14:49 -05:00
Rubén Dávila 207522f923 Some refactor to the revert commit creation.
* Not required to run hooks since it's an internal commit
2016-02-19 13:14:49 -05:00
Rubén Dávila 720e52d9d9 Add merge_commit_sha column to merge_requests. 2016-02-19 13:14:48 -05:00
Rubén Dávila d7511a4b04 Create reverse branch and generate MR with new branch. #3409 2016-02-19 13:14:48 -05:00
Rubén Dávila 2770de9617 Reopened MRs should also be considered as open. 2016-02-17 21:15:13 -05:00
Nemanja Boric 8172d5ca54 Don't try to mark broken MR as mergable
In case merge request is broken, we shouldn't check if the sha
is mergable, as it will be null, and there's no point, as we know
that it's not mergable.
2016-02-11 00:38:07 +01:00
Douglas Barbosa Alexandre 1353cff5fe Replaces "Create merge request" link with one to the MR when one exists 2016-02-10 10:32:25 -02:00
Douwe Maan b5befc734b Merge branch 'disable-remove-source-branch' into 'master'
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
2016-02-04 11:56:58 +00:00
Zeger-Jan van de Weg c6e0228ca9 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
2016-02-04 11:56:23 +01:00
Douwe Maan a1fa973123 Merge branch 'wipMergeSpacing' into 'master'
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
2016-02-04 09:49:54 +00:00
Robert Speicher f8052310ad Merge branch 'merge-request-closes-issues-performance' into 'master'
Optimize fetching issues closed by a merge request

Related issue: #12419

See merge request !2625
2016-02-01 15:32:58 -05:00
Yorick Peterse 99492d6b8d Optimize fetching issues closed by a merge request
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
2016-02-01 11:04:05 +01:00
Douwe Maan 30b0d06e9f Fix specs 2016-01-28 15:10:48 +01:00
Douwe Maan 5cce1278ad Correctly determine MR diff base when MR has merge conflicts 2016-01-27 17:23:59 +01:00
Douwe Maan 577f2fb47a Save and use actual diff base commit for MR diff highlighting 2016-01-20 18:44:27 +01:00
Douwe Maan 987e3d94b0 Fix MR diff_refs 2016-01-20 15:40:49 +01:00
Rubén Dávila c7264d2a76 Check if MR is not broken. 2016-01-19 11:40:43 -05:00
Rubén Dávila c8db25c37c Merge branch 'master' into issue_3945 2016-01-14 17:28:44 -05:00
Rubén Dávila 6b9c730e91 More refactoring from last code review. #3945
* Use commit objects instead of IDs when generating diffs
* Use proper references when generating MR's source and target
* Update broken specs
2016-01-14 16:47:55 -05:00
Dmitriy Zaporozhets 5500f9159f Merge branch 'group-issues-sorting' into 'master'
Improve performance of getting issues on group level

For testing I used the URL http://localhost:3000/groups/gitlab-org/issues?milestone_title=8.1. Prior to these changes said URL would take about 10-12 seconds to load. By applying these changes the loading time has been reduced to roughly 2-3 seconds. 

There's still some stuff going on in some views that I have to look at, resolving those changes might reduce the loading time a bit more. I also still have to check if I didn't break too many tests.

Fixes: gitlab-org/gitlab-ce#3707 gitlab-org/gitlab-ce#4071 

See merge request !2318
2016-01-11 15:28:41 +00:00
Dmitriy Zaporozhets 3c93e588e9 Merge branch 'annotate-models-20160105' into 'master'
Annotate models

Time to refresh the comments via `annotate`.


See merge request !2311
2016-01-07 18:22:32 +00:00