Commit Graph

276 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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