Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
09112dbb
Commit
09112dbb
authored
Jun 26, 2013
by
Izaak Alpert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rebase on master
Trying to retrigger travis Change-Id: Ifd86fb4c6b2791ad176230254fbf69a9ade979fb
parent
bbef8bb5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
11 deletions
+21
-11
app/models/merge_request.rb
app/models/merge_request.rb
+2
-2
app/observers/merge_request_observer.rb
app/observers/merge_request_observer.rb
+0
-1
features/steps/project/project_merge_requests.rb
features/steps/project/project_merge_requests.rb
+9
-3
spec/contexts/filter_context_spec.rb
spec/contexts/filter_context_spec.rb
+1
-1
spec/services/notification_service_spec.rb
spec/services/notification_service_spec.rb
+9
-4
No files found.
app/models/merge_request.rb
View file @
09112dbb
...
@@ -105,11 +105,11 @@ class MergeRequest < ActiveRecord::Base
...
@@ -105,11 +105,11 @@ class MergeRequest < ActiveRecord::Base
end
end
if
opened?
||
reopened?
if
opened?
||
reopened?
similar_mrs
=
self
.
project
.
merge_requests
.
where
(
source_branch:
source_branch
,
target_branch:
target_branch
).
opened
similar_mrs
=
self
.
target_project
.
merge_requests
.
where
(
source_branch:
source_branch
,
target_branch:
target_branch
,
source_project_id:
source_project
.
id
).
opened
similar_mrs
=
similar_mrs
.
where
(
'id not in (?)'
,
self
.
id
)
if
self
.
id
similar_mrs
=
similar_mrs
.
where
(
'id not in (?)'
,
self
.
id
)
if
self
.
id
if
similar_mrs
.
any?
if
similar_mrs
.
any?
errors
.
add
:base
,
"
There is already an open merge request for this branches
"
errors
.
add
:base
,
"
Cannot Create: This merge request already exists:
#{
similar_mrs
.
pluck
(
:title
)
}
"
end
end
end
end
end
end
...
...
app/observers/merge_request_observer.rb
View file @
09112dbb
class
MergeRequestObserver
<
ActivityObserver
class
MergeRequestObserver
<
ActivityObserver
observe
:merge_request
observe
:merge_request
cattr_accessor
:current_user
def
after_create
(
merge_request
)
def
after_create
(
merge_request
)
event_author_id
=
merge_request
.
author_id
event_author_id
=
merge_request
.
author_id
...
...
features/steps/project/project_merge_requests.rb
View file @
09112dbb
...
@@ -57,11 +57,17 @@ class ProjectMergeRequests < Spinach::FeatureSteps
...
@@ -57,11 +57,17 @@ class ProjectMergeRequests < Spinach::FeatureSteps
end
end
And
'I submit new merge request "Wiki Feature"'
do
And
'I submit new merge request "Wiki Feature"'
do
fill_in
"merge_request_title"
,
:with
=>
"Wiki Feature"
#this must come first, so that the target branch is set by the time the "select" for "notes_refactoring" is executed
select
project
.
path_with_namespace
,
:from
=>
"merge_request_target_project_id"
select
project
.
path_with_namespace
,
:from
=>
"merge_request_target_project_id"
fill_in
"merge_request_title"
,
:with
=>
"Wiki Feature"
select
"master"
,
:from
=>
"merge_request_source_branch"
select
"master"
,
:from
=>
"merge_request_source_branch"
select
"stable"
,
:from
=>
"merge_request_target_branch"
find
(
:select
,
"merge_request_target_project_id"
,
{}).
value
.
should
==
project
.
id
.
to_s
find
(
:select
,
"merge_request_target_branch"
,
{}).
find
(
:option
,
"stable"
,
{}).
value
.
should
==
"stable"
find
(
:select
,
"merge_request_source_project_id"
,
{}).
value
.
should
==
project
.
id
.
to_s
#using "notes_refactoring" because "Bug NS-04" uses master/stable, this will fail merge_request validation if the branches are the same
find
(
:select
,
"merge_request_target_branch"
,
{}).
find
(
:option
,
"notes_refactoring"
,
{}).
value
.
should
==
"notes_refactoring"
select
"notes_refactoring"
,
:from
=>
"merge_request_target_branch"
click_button
"Submit merge request"
click_button
"Submit merge request"
end
end
...
...
spec/contexts/filter_context_spec.rb
View file @
09112dbb
...
@@ -9,7 +9,7 @@ describe FilterContext do
...
@@ -9,7 +9,7 @@ describe FilterContext do
let
(
:merge_request1
)
{
create
(
:merge_request
,
author_id:
user
.
id
,
source_project:
project1
,
target_project:
project2
)
}
let
(
:merge_request1
)
{
create
(
:merge_request
,
author_id:
user
.
id
,
source_project:
project1
,
target_project:
project2
)
}
let
(
:merge_request2
)
{
create
(
:merge_request
,
author_id:
user
.
id
,
source_project:
project2
,
target_project:
project1
)
}
let
(
:merge_request2
)
{
create
(
:merge_request
,
author_id:
user
.
id
,
source_project:
project2
,
target_project:
project1
)
}
let
(
:merge_request3
)
{
create
(
:merge_request
,
author_id:
user
.
id
,
source_project:
project2
,
target_project:
project2
)
}
let
(
:merge_request3
)
{
create
(
:merge_request
,
author_id:
user
.
id
,
source_project:
project2
,
target_project:
project2
)
}
let
(
:merge_request4
)
{
create
(
:merge_request
,
author_id:
user2
.
id
,
source_project:
project2
,
target_project:
project2
)
}
let
(
:merge_request4
)
{
create
(
:merge_request
,
author_id:
user2
.
id
,
source_project:
project2
,
target_project:
project2
,
target_branch
:"notes_refactoring"
)
}
let
(
:issue1
)
{
create
(
:issue
,
assignee_id:
user
.
id
,
project:
project1
)
}
let
(
:issue1
)
{
create
(
:issue
,
assignee_id:
user
.
id
,
project:
project1
)
}
let
(
:issue2
)
{
create
(
:issue
,
assignee_id:
user
.
id
,
project:
project2
)
}
let
(
:issue2
)
{
create
(
:issue
,
assignee_id:
user
.
id
,
project:
project2
)
}
let
(
:issue3
)
{
create
(
:issue
,
assignee_id:
user2
.
id
,
project:
project2
)
}
let
(
:issue3
)
{
create
(
:issue
,
assignee_id:
user2
.
id
,
project:
project2
)
}
...
...
spec/services/notification_service_spec.rb
View file @
09112dbb
...
@@ -232,11 +232,16 @@ describe NotificationService do
...
@@ -232,11 +232,16 @@ describe NotificationService do
end
end
end
end
let
(
:u_watcher
)
{
create
(
:user
,
notification_level:
Notification
::
N_WATCH
)
}
let
(
:u_participating
)
{
create
(
:user
,
notification_level:
Notification
::
N_PARTICIPATING
)
}
let
(
:u_disabled
)
{
create
(
:user
,
notification_level:
Notification
::
N_DISABLED
)
}
let
(
:u_mentioned
)
{
create
(
:user
,
username:
'mention'
,
notification_level:
Notification
::
N_WATCH
)
}
def
build_team
(
project
)
def
build_team
(
project
)
@u_watcher
=
create
(
:user
,
notification_level:
Notification
::
N_WATCH
)
@u_watcher
=
u_watcher
@u_participating
=
create
(
:user
,
notification_level:
Notification
::
N_PARTICIPATING
)
@u_participating
=
u_participating
@u_disabled
=
create
(
:user
,
notification_level:
Notification
::
N_DISABLED
)
@u_disabled
=
u_disabled
@u_mentioned
=
create
(
:user
,
username:
'mention'
,
notification_level:
Notification
::
N_WATCH
)
@u_mentioned
=
u_mentioned
project
.
team
<<
[
@u_watcher
,
:master
]
project
.
team
<<
[
@u_watcher
,
:master
]
project
.
team
<<
[
@u_participating
,
:master
]
project
.
team
<<
[
@u_participating
,
:master
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment