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
1
Merge Requests
1
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
nexedi
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
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
14 deletions
+19
-14
app/controllers/merge_requests_controller.rb
app/controllers/merge_requests_controller.rb
+2
-2
app/models/merge_request.rb
app/models/merge_request.rb
+9
-9
app/views/merge_requests/_show.html.haml
app/views/merge_requests/_show.html.haml
+2
-2
db/migrate/20130214154045_rename_state_to_merge_status_in_milestone.rb
...130214154045_rename_state_to_merge_status_in_milestone.rb
+5
-0
spec/models/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
...
@@ -73,9 +73,9 @@ class MergeRequestsController < ProjectResourceController
if
@merge_request
.
unchecked?
if
@merge_request
.
unchecked?
@merge_request
.
check_if_can_be_merged
@merge_request
.
check_if_can_be_merged
end
end
render
json:
{
state:
@merge_request
.
human_state
}
render
json:
{
merge_status:
@merge_request
.
human_merge_status
}
rescue
Gitlab
::
SatelliteNotExistError
rescue
Gitlab
::
SatelliteNotExistError
render
json:
{
state
: :no_satellite
}
render
json:
{
merge_status
: :no_satellite
}
end
end
def
automerge
def
automerge
...
...
app/models/merge_request.rb
View file @
8db3920c
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
# st_commits :text(2147483647)
# st_commits :text(2147483647)
# st_diffs :text(2147483647)
# st_diffs :text(2147483647)
# merged :boolean default(FALSE), not null
# merged :boolean default(FALSE), not null
#
state
:integer default(1), not null
#
merge_status
:integer default(1), not null
# milestone_id :integer
# milestone_id :integer
#
#
...
@@ -51,13 +51,13 @@ class MergeRequest < ActiveRecord::Base
...
@@ -51,13 +51,13 @@ class MergeRequest < ActiveRecord::Base
where
(
"milestone_id = :milestone_id"
,
milestone_id:
milestone
)
where
(
"milestone_id = :milestone_id"
,
milestone_id:
milestone
)
end
end
def
human_
state
def
human_
merge_status
stat
es
=
{
merge_status
es
=
{
CAN_BE_MERGED
=>
"can_be_merged"
,
CAN_BE_MERGED
=>
"can_be_merged"
,
CANNOT_BE_MERGED
=>
"cannot_be_merged"
,
CANNOT_BE_MERGED
=>
"cannot_be_merged"
,
UNCHECKED
=>
"unchecked"
UNCHECKED
=>
"unchecked"
}
}
states
[
self
.
state
]
merge_statuses
[
self
.
merge_status
]
end
end
def
validate_branches
def
validate_branches
...
@@ -72,20 +72,20 @@ class MergeRequest < ActiveRecord::Base
...
@@ -72,20 +72,20 @@ class MergeRequest < ActiveRecord::Base
end
end
def
unchecked?
def
unchecked?
state
==
UNCHECKED
merge_status
==
UNCHECKED
end
end
def
mark_as_unchecked
def
mark_as_unchecked
self
.
state
=
UNCHECKED
self
.
merge_status
=
UNCHECKED
self
.
save
self
.
save
end
end
def
can_be_merged?
def
can_be_merged?
state
==
CAN_BE_MERGED
merge_status
==
CAN_BE_MERGED
end
end
def
check_if_can_be_merged
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
CAN_BE_MERGED
else
else
CANNOT_BE_MERGED
CANNOT_BE_MERGED
...
@@ -160,7 +160,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -160,7 +160,7 @@ class MergeRequest < ActiveRecord::Base
end
end
def
mark_as_unmergable
def
mark_as_unmergable
self
.
state
=
CANNOT_BE_MERGED
self
.
merge_status
=
CANNOT_BE_MERGED
self
.
save
self
.
save
end
end
...
...
app/views/merge_requests/_show.html.haml
View file @
8db3920c
...
@@ -29,10 +29,10 @@
...
@@ -29,10 +29,10 @@
$
(
function
(){
$
(
function
(){
merge_request
=
new
MergeRequest
({
merge_request
=
new
MergeRequest
({
url_to_automerge_check
:
"
#{
automerge_check_project_merge_request_path
(
@project
,
@merge_request
)
}
"
,
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
)
}
"
,
url_to_ci_check
:
"
#{
ci_status_project_merge_request_path
(
@project
,
@merge_request
)
}
"
,
ci_enable
:
#{
@project
.
gitlab_ci?
?
"true"
:
"false"
}
,
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
}
"
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 @@
...
@@ -15,7 +15,7 @@
# st_commits :text(2147483647)
# st_commits :text(2147483647)
# st_diffs :text(2147483647)
# st_diffs :text(2147483647)
# merged :boolean default(FALSE), not null
# merged :boolean default(FALSE), not null
#
state
:integer default(1), not null
#
merge_status
:integer default(1), not null
# milestone_id :integer
# 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