Commit 3bb342b961f2a02098175e24855ab56fc1785c43

Authored by Sebastian Ziebell
2 parents 7499f650 33cd1ae9

Merge branch 'master' into fixes/api

1 -# Welcome to GitLab [![build status](https://secure.travis-ci.org/gitlabhq/gitlabhq.png)](https://travis-ci.org/gitlabhq/gitlabhq) [![build status](https://secure.travis-ci.org/gitlabhq/grit.png)](https://travis-ci.org/gitlabhq/grit) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/gitlabhq/gitlabhq) [![Dependency Status](https://gemnasium.com/gitlabhq/gitlabhq.png)](https://gemnasium.com/gitlabhq/gitlabhq) 1 +# Welcome to GitLab! Self hosted Git management software
  2 +
  3 +
  4 +## Badges:
  5 +
  6 +* master: travis-ci.org [![build status](https://secure.travis-ci.org/gitlabhq/gitlabhq.png)](https://travis-ci.org/gitlabhq/gitlabhq)a
  7 +* master: ci.gitlab.org [![CI](http://ci.gitlab.org/projects/1/status?ref=master)](http://ci.gitlab.org/projects/1?ref=master)
  8 +* [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/gitlabhq/gitlabhq)
  9 +* [![Dependency Status](https://gemnasium.com/gitlabhq/gitlabhq.png)](https://gemnasium.com/gitlabhq/gitlabhq)
2 10
3 GitLab is a free project and repository management application 11 GitLab is a free project and repository management application
4 12
5 -[![CI](http://ci.gitlab.org/projects/1/status?ref=master)](http://ci.gitlab.org/projects/1?ref=master)  
6 13
7 ## Application details 14 ## Application details
8 15
9 -* based on Ruby on Rails 16 +* powered by Ruby on Rails
  17 +* its completely free and open source
10 * distributed under the MIT License 18 * distributed under the MIT License
11 -* works with gitolite  
12 19
13 ## Requirements 20 ## Requirements
14 21
@@ -16,27 +23,16 @@ GitLab is a free project and repository management application @@ -16,27 +23,16 @@ GitLab is a free project and repository management application
16 * ruby 1.9.3+ 23 * ruby 1.9.3+
17 * MySQL 24 * MySQL
18 * git 25 * git
19 -* gitolite 26 +* gitlab-shell
20 * redis 27 * redis
21 28
22 ## Install 29 ## Install
23 30
24 -Checkout wiki pages for installation information, migration, etc.  
25 -  
26 -## Community  
27 -  
28 -[Google Group](https://groups.google.com/group/gitlabhq)  
29 -  
30 -## Contacts  
31 -  
32 -Twitter:  
33 -  
34 - * @gitlabhq  
35 - * @dzaporozhets 31 +Checkout [wiki](https://github.com/gitlabhq/gitlabhq/wiki) pages for installation information, migration, etc.
36 32
37 -Email 33 +## [Community](http://gitlab.org/community/)
38 34
39 - * m@gitlabhq.com 35 +## [Contact](http://gitlab.org/contact/)
40 36
41 ## Contribute 37 ## Contribute
42 38
app/models/merge_request.rb
@@ -177,15 +177,8 @@ class MergeRequest < ActiveRecord::Base @@ -177,15 +177,8 @@ class MergeRequest < ActiveRecord::Base
177 end 177 end
178 178
179 def merge!(user_id) 179 def merge!(user_id)
  180 + self.author_id_of_changes = user_id
180 self.merge 181 self.merge
181 -  
182 - Event.create(  
183 - project: self.project,  
184 - action: Event::MERGED,  
185 - target_id: self.id,  
186 - target_type: "MergeRequest",  
187 - author_id: user_id  
188 - )  
189 end 182 end
190 183
191 def automerge!(current_user) 184 def automerge!(current_user)
app/observers/activity_observer.rb
@@ -39,4 +39,18 @@ class ActivityObserver < ActiveRecord::Observer @@ -39,4 +39,18 @@ class ActivityObserver < ActiveRecord::Observer
39 author_id: record.author_id_of_changes 39 author_id: record.author_id_of_changes
40 ) 40 )
41 end 41 end
  42 +
  43 + def after_merge(record, transition)
  44 + # Since MR can be merged via sidekiq
  45 + # to prevent event duplication do this check
  46 + return true if record.merge_event
  47 +
  48 + Event.create(
  49 + project: record.project,
  50 + target_id: record.id,
  51 + target_type: record.class.name,
  52 + action: Event::MERGED,
  53 + author_id: record.author_id_of_changes
  54 + )
  55 + end
42 end 56 end
lib/api/projects.rb
@@ -336,7 +336,7 @@ module Gitlab @@ -336,7 +336,7 @@ module Gitlab
336 authorize! :download_code, user_project 336 authorize! :download_code, user_project
337 337
338 page = params[:page] || 0 338 page = params[:page] || 0
339 - per_page = params[:per_page].to_i || 20 339 + per_page = (params[:per_page] || 20).to_i
340 ref = params[:ref_name] || user_project.try(:default_branch) || 'master' 340 ref = params[:ref_name] || user_project.try(:default_branch) || 'master'
341 341
342 commits = user_project.repository.commits(ref, nil, per_page, page * per_page) 342 commits = user_project.repository.commits(ref, nil, per_page, page * per_page)