BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
8db3920c
Commit
8db3920c
authored
Feb 15, 2013
by
Andrew8xx8
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
State renamed to merge_status
parent
26d4574a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
14 deletions
+19
-14
merge_requests_controller.rb
app/controllers/merge_requests_controller.rb
+2
-2
merge_request.rb
app/models/merge_request.rb
+9
-9
_show.html.haml
app/views/merge_requests/_show.html.haml
+2
-2
20130214154045_rename_state_to_merge_status_in_milestone.rb
...130214154045_rename_state_to_merge_status_in_milestone.rb
+5
-0
merge_request_spec.rb
spec/models/merge_request_spec.rb
+1
-1
No files found.
app/controllers/merge_requests_controller.rb
View file @
8db3920c
...
...
@@ -73,9 +73,9 @@ class MergeRequestsController < ProjectResourceController
if
@merge_request
.
unchecked?
@merge_request
.
check_if_can_be_merged
end
render
json:
{
state:
@merge_request
.
human_state
}
render
json:
{
merge_status:
@merge_request
.
human_merge_status
}
rescue
Gitlab
::
SatelliteNotExistError
render
json:
{
state
: :no_satellite
}
render
json:
{
merge_status
: :no_satellite
}
end
def
automerge
...
...
app/models/merge_request.rb
View file @
8db3920c
...
...
@@ -15,7 +15,7 @@
# st_commits :text(2147483647)
# st_diffs :text(2147483647)
# merged :boolean default(FALSE), not null
#
state
:integer default(1), not null
#
merge_status
:integer default(1), not null
# milestone_id :integer
#
...
...
@@ -51,13 +51,13 @@ class MergeRequest < ActiveRecord::Base
where
(
"milestone_id = :milestone_id"
,
milestone_id:
milestone
)
end
def
human_
state
stat
es
=
{
def
human_
merge_status
merge_status
es
=
{
CAN_BE_MERGED
=>
"can_be_merged"
,
CANNOT_BE_MERGED
=>
"cannot_be_merged"
,
UNCHECKED
=>
"unchecked"
}
states
[
self
.
state
]
merge_statuses
[
self
.
merge_status
]
end
def
validate_branches
...
...
@@ -72,20 +72,20 @@ class MergeRequest < ActiveRecord::Base
end
def
unchecked?
state
==
UNCHECKED
merge_status
==
UNCHECKED
end
def
mark_as_unchecked
self
.
state
=
UNCHECKED
self
.
merge_status
=
UNCHECKED
self
.
save
end
def
can_be_merged?
state
==
CAN_BE_MERGED
merge_status
==
CAN_BE_MERGED
end
def
check_if_can_be_merged
self
.
state
=
if
Gitlab
::
Satellite
::
MergeAction
.
new
(
self
.
author
,
self
).
can_be_merged?
self
.
merge_status
=
if
Gitlab
::
Satellite
::
MergeAction
.
new
(
self
.
author
,
self
).
can_be_merged?
CAN_BE_MERGED
else
CANNOT_BE_MERGED
...
...
@@ -160,7 +160,7 @@ class MergeRequest < ActiveRecord::Base
end
def
mark_as_unmergable
self
.
state
=
CANNOT_BE_MERGED
self
.
merge_status
=
CANNOT_BE_MERGED
self
.
save
end
...
...
app/views/merge_requests/_show.html.haml
View file @
8db3920c
...
...
@@ -29,10 +29,10 @@
$
(
function
(){
merge_request
=
new
MergeRequest
({
url_to_automerge_check
:
"
#{
automerge_check_project_merge_request_path
(
@project
,
@merge_request
)
}
"
,
check_enable
:
#{
@merge_request
.
state
==
MergeRequest
::
UNCHECKED
?
"true"
:
"false"
}
,
check_enable
:
#{
@merge_request
.
merge_status
==
MergeRequest
::
UNCHECKED
?
"true"
:
"false"
}
,
url_to_ci_check
:
"
#{
ci_status_project_merge_request_path
(
@project
,
@merge_request
)
}
"
,
ci_enable
:
#{
@project
.
gitlab_ci?
?
"true"
:
"false"
}
,
current_stat
e
:
"
#{
@merge_request
.
human_state
}
"
,
current_stat
us
:
"
#{
@merge_request
.
human_merge_status
}
"
,
action
:
"
#{
controller
.
action_name
}
"
});
});
...
...
db/migrate/20130214154045_rename_state_to_merge_status_in_milestone.rb
0 → 100644
View file @
8db3920c
class
RenameStateToMergeStatusInMilestone
<
ActiveRecord
::
Migration
def
change
rename_column
:merge_requests
,
:state
,
:merge_status
end
end
spec/models/merge_request_spec.rb
View file @
8db3920c
...
...
@@ -15,7 +15,7 @@
# st_commits :text(2147483647)
# st_diffs :text(2147483647)
# merged :boolean default(FALSE), not null
#
state
:integer default(1), not null
#
merge_status
:integer default(1), not null
# milestone_id :integer
#
...
...
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