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
Jérome Perrin
gitlab-ce
Commits
3676838d
Commit
3676838d
authored
Mar 13, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rspec test repo replaced.\nMerge Requests improved
parent
781f5aa6
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
90 additions
and
41 deletions
+90
-41
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+22
-2
app/controllers/merge_requests_controller.rb
app/controllers/merge_requests_controller.rb
+8
-0
app/models/merge_request.rb
app/models/merge_request.rb
+8
-0
app/views/merge_requests/_form.html.haml
app/views/merge_requests/_form.html.haml
+16
-2
app/views/merge_requests/branch_from.js.haml
app/views/merge_requests/branch_from.js.haml
+2
-0
app/views/merge_requests/branch_to.js.haml
app/views/merge_requests/branch_to.js.haml
+3
-0
config/routes.rb
config/routes.rb
+5
-0
db/fixtures/test/001_repo.rb
db/fixtures/test/001_repo.rb
+2
-2
spec/factories.rb
spec/factories.rb
+3
-3
spec/models/note_spec.rb
spec/models/note_spec.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+7
-8
spec/requests/admin/admin_projects_spec.rb
spec/requests/admin/admin_projects_spec.rb
+1
-1
spec/requests/merge_requests_spec.rb
spec/requests/merge_requests_spec.rb
+1
-1
spec/requests/projects_spec.rb
spec/requests/projects_spec.rb
+1
-1
spec/requests/projects_tree_spec.rb
spec/requests/projects_tree_spec.rb
+2
-2
spec/requests/repositories_spec.rb
spec/requests/repositories_spec.rb
+1
-1
spec/seed_project.tar.gz
spec/seed_project.tar.gz
+0
-0
spec/support/valid_commit.rb
spec/support/valid_commit.rb
+7
-17
No files found.
app/assets/stylesheets/common.scss
View file @
3676838d
...
@@ -531,7 +531,7 @@ table a code {
...
@@ -531,7 +531,7 @@ table a code {
/** FLASH message **/
/** FLASH message **/
#flash_container
{
#flash_container
{
height
:
45
px
;
height
:
50
px
;
position
:fixed
;
position
:fixed
;
z-index
:
10001
;
z-index
:
10001
;
top
:
0px
;
top
:
0px
;
...
@@ -540,7 +540,7 @@ table a code {
...
@@ -540,7 +540,7 @@ table a code {
overflow
:hidden
;
overflow
:hidden
;
background
:white
;
background
:white
;
cursor
:pointer
;
cursor
:pointer
;
border-bottom
:
1px
solid
#
777
;
border-bottom
:
1px
solid
#
ccc
;
h4
{
h4
{
color
:
#444
;
color
:
#444
;
...
@@ -901,3 +901,23 @@ p.time {
...
@@ -901,3 +901,23 @@ p.time {
margin
:
2px
;
margin
:
2px
;
}
}
}
}
.mr_source_commit
,
.mr_target_commit
{
.commit
{
list-style
:none
;
margin-top
:
10px
;
&
:hover
{
background
:none
;
}
}
}
.prettyprint
{
background-color
:
#fefbf3
;
padding
:
9px
;
border
:
1px
solid
rgba
(
0
,
0
,
0
,.
2
);
-webkit-box-shadow
:
0
1px
2px
rgba
(
0
,
0
,
0
,.
1
);
-moz-box-shadow
:
0
1px
2px
rgba
(
0
,
0
,
0
,.
1
);
box-shadow
:
0
1px
2px
rgba
(
0
,
0
,
0
,.
1
);
}
app/controllers/merge_requests_controller.rb
View file @
3676838d
...
@@ -106,6 +106,14 @@ class MergeRequestsController < ApplicationController
...
@@ -106,6 +106,14 @@ class MergeRequestsController < ApplicationController
end
end
end
end
def
branch_from
@commit
=
project
.
commit
(
params
[
:ref
])
end
def
branch_to
@commit
=
project
.
commit
(
params
[
:ref
])
end
protected
protected
def
merge_request
def
merge_request
...
...
app/models/merge_request.rb
View file @
3676838d
...
@@ -12,6 +12,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -12,6 +12,7 @@ class MergeRequest < ActiveRecord::Base
validates_presence_of
:author_id
validates_presence_of
:author_id
validates_presence_of
:source_branch
validates_presence_of
:source_branch
validates_presence_of
:target_branch
validates_presence_of
:target_branch
validate
:validate_branches
delegate
:name
,
delegate
:name
,
:email
,
:email
,
...
@@ -31,6 +32,13 @@ class MergeRequest < ActiveRecord::Base
...
@@ -31,6 +32,13 @@ class MergeRequest < ActiveRecord::Base
scope
:closed
,
where
(
:closed
=>
true
)
scope
:closed
,
where
(
:closed
=>
true
)
scope
:assigned
,
lambda
{
|
u
|
where
(
:assignee_id
=>
u
.
id
)}
scope
:assigned
,
lambda
{
|
u
|
where
(
:assignee_id
=>
u
.
id
)}
def
validate_branches
if
target_branch
==
source_branch
errors
.
add
:base
,
"You can not use same branch for source and target branches"
end
end
def
new?
def
new?
today?
&&
created_at
==
updated_at
today?
&&
created_at
==
updated_at
end
end
...
...
app/views/merge_requests/_form.html.haml
View file @
3676838d
...
@@ -10,10 +10,14 @@
...
@@ -10,10 +10,14 @@
.input
=
f
.
text_area
:title
,
:class
=>
"xxlarge"
,
:maxlength
=>
255
,
:rows
=>
5
.input
=
f
.
text_area
:title
,
:class
=>
"xxlarge"
,
:maxlength
=>
255
,
:rows
=>
5
.clearfix
.clearfix
=
f
.
label
:source_branch
,
"From"
=
f
.
label
:source_branch
,
"From"
.input
=
f
.
select
(
:source_branch
,
@project
.
heads
.
map
(
&
:name
),
{
:include_blank
=>
"Select branch"
},
:style
=>
"width:250px"
)
.input
=
f
.
select
(
:source_branch
,
@project
.
heads
.
map
(
&
:name
),
{
:include_blank
=>
"Select branch"
},
:style
=>
"width:250px"
)
.mr_source_commit
.clearfix
.clearfix
=
f
.
label
:target_branch
,
"To"
=
f
.
label
:target_branch
,
"To"
.input
=
f
.
select
(
:target_branch
,
@project
.
heads
.
map
(
&
:name
),
{
:include_blank
=>
"Select branch"
},
:style
=>
"width:250px"
)
.input
=
f
.
select
(
:target_branch
,
@project
.
heads
.
map
(
&
:name
),
{
:include_blank
=>
"Select branch"
},
:style
=>
"width:250px"
)
.mr_target_commit
.clearfix
.clearfix
=
f
.
label
:assignee_id
,
"Assign to"
=
f
.
label
:assignee_id
,
"Assign to"
.input
=
f
.
select
(
:assignee_id
,
@project
.
users
.
all
.
collect
{
|
p
|
[
p
.
name
,
p
.
id
]
},
{
:include_blank
=>
"Select user"
},
:style
=>
"width:250px"
)
.input
=
f
.
select
(
:assignee_id
,
@project
.
users
.
all
.
collect
{
|
p
|
[
p
.
name
,
p
.
id
]
},
{
:include_blank
=>
"Select user"
},
:style
=>
"width:250px"
)
...
@@ -34,5 +38,15 @@
...
@@ -34,5 +38,15 @@
$
(
'
select#merge_request_assignee_id
'
).
chosen
();
$
(
'
select#merge_request_assignee_id
'
).
chosen
();
$
(
'
select#merge_request_source_branch
'
).
chosen
();
$
(
'
select#merge_request_source_branch
'
).
chosen
();
$
(
'
select#merge_request_target_branch
'
).
chosen
();
$
(
'
select#merge_request_target_branch
'
).
chosen
();
$
(
"
#merge_request_source_branch
"
).
live
(
"
change
"
,
function
()
{
$
.
get
(
"
#{
branch_from_project_merge_requests_path
(
@project
)
}
"
,
{
ref
:
$
(
this
).
val
()
});
});
$
(
"
#merge_request_target_branch
"
).
live
(
"
change
"
,
function
()
{
$
.
get
(
"
#{
branch_to_project_merge_requests_path
(
@project
)
}
"
,
{
ref
:
$
(
this
).
val
()
});
});
});
});
app/views/merge_requests/branch_from.js.haml
0 → 100644
View file @
3676838d
:plain
$(".mr_source_commit").html("
#{
escape_javascript
(
render
'commits/commit'
,
:commit
=>
@commit
)
}
");
app/views/merge_requests/branch_to.js.haml
0 → 100644
View file @
3676838d
:plain
$(".mr_target_commit").html("
#{
escape_javascript
(
render
'commits/commit'
,
:commit
=>
@commit
)
}
");
config/routes.rb
View file @
3676838d
...
@@ -101,6 +101,11 @@ Gitlab::Application.routes.draw do
...
@@ -101,6 +101,11 @@ Gitlab::Application.routes.draw do
member
do
member
do
get
:diffs
get
:diffs
end
end
collection
do
get
:branch_from
get
:branch_to
end
end
end
resources
:snippets
resources
:snippets
...
...
db/fixtures/test/001_repo.rb
View file @
3676838d
...
@@ -10,6 +10,6 @@ Dir.mkdir(repo_dir) unless File.exists?(repo_dir)
...
@@ -10,6 +10,6 @@ Dir.mkdir(repo_dir) unless File.exists?(repo_dir)
Dir
.
chdir
(
repo_dir
)
Dir
.
chdir
(
repo_dir
)
`tar -xf seed_project.tar.gz`
`tar -xf seed_project.tar.gz`
3
.
times
do
|
i
|
3
.
times
do
|
i
|
`cp -r
legit/ legit
_
#{
i
}
/`
`cp -r
gitlabhq/ gitlabhq
_
#{
i
}
/`
puts
"Unpacked seed repo - tmp/tests/
legit
_
#{
i
}
"
puts
"Unpacked seed repo - tmp/tests/
gitlabhq
_
#{
i
}
"
end
end
spec/factories.rb
View file @
3676838d
...
@@ -2,14 +2,14 @@ require File.join(Rails.root, 'spec', 'factory')
...
@@ -2,14 +2,14 @@ require File.join(Rails.root, 'spec', 'factory')
Factory
.
add
(
:project
,
Project
)
do
|
obj
|
Factory
.
add
(
:project
,
Project
)
do
|
obj
|
obj
.
name
=
Faker
::
Internet
.
user_name
obj
.
name
=
Faker
::
Internet
.
user_name
obj
.
path
=
'
legit
'
obj
.
path
=
'
gitlabhq
'
obj
.
owner
=
Factory
(
:user
)
obj
.
owner
=
Factory
(
:user
)
obj
.
code
=
'LGT'
obj
.
code
=
'LGT'
end
end
Factory
.
add
(
:public_project
,
Project
)
do
|
obj
|
Factory
.
add
(
:public_project
,
Project
)
do
|
obj
|
obj
.
name
=
Faker
::
Internet
.
user_name
obj
.
name
=
Faker
::
Internet
.
user_name
obj
.
path
=
'
legit
'
obj
.
path
=
'
gitlabhq
'
obj
.
private_flag
=
false
obj
.
private_flag
=
false
obj
.
owner
=
Factory
(
:user
)
obj
.
owner
=
Factory
(
:user
)
obj
.
code
=
'LGT'
obj
.
code
=
'LGT'
...
@@ -41,7 +41,7 @@ Factory.add(:merge_request, MergeRequest) do |obj|
...
@@ -41,7 +41,7 @@ Factory.add(:merge_request, MergeRequest) do |obj|
obj
.
author
=
Factory
:user
obj
.
author
=
Factory
:user
obj
.
assignee
=
Factory
:user
obj
.
assignee
=
Factory
:user
obj
.
source_branch
=
"master"
obj
.
source_branch
=
"master"
obj
.
target_branch
=
"
master
"
obj
.
target_branch
=
"
stable
"
obj
.
closed
=
false
obj
.
closed
=
false
end
end
...
...
spec/models/note_spec.rb
View file @
3676838d
...
@@ -54,7 +54,7 @@ describe Note do
...
@@ -54,7 +54,7 @@ describe Note do
describe
:authorization
do
describe
:authorization
do
before
do
before
do
@p1
=
project
@p1
=
project
@p2
=
Factory
:project
,
:code
=>
"alien"
,
:path
=>
"
legit
_1"
@p2
=
Factory
:project
,
:code
=>
"alien"
,
:path
=>
"
gitlabhq
_1"
@u1
=
Factory
:user
@u1
=
Factory
:user
@u2
=
Factory
:user
@u2
=
Factory
:user
@u3
=
Factory
:user
@u3
=
Factory
:user
...
...
spec/models/project_spec.rb
View file @
3676838d
...
@@ -86,23 +86,22 @@ describe Project do
...
@@ -86,23 +86,22 @@ describe Project do
let
(
:project
)
{
Factory
:project
}
let
(
:project
)
{
Factory
:project
}
it
{
project
.
fresh_commits
(
3
).
count
.
should
==
3
}
it
{
project
.
fresh_commits
(
3
).
count
.
should
==
3
}
it
{
project
.
fresh_commits
.
first
.
id
.
should
==
"
2fb376f61875b58bceee0492e270e9c805294b1
a"
}
it
{
project
.
fresh_commits
.
first
.
id
.
should
==
"
bcf03b5de6c33f3869ef70d68cf06e679d1d7f9
a"
}
it
{
project
.
fresh_commits
.
last
.
id
.
should
==
"
0dac878dbfe0b9c6104a87d65fe999149a8d862c
"
}
it
{
project
.
fresh_commits
.
last
.
id
.
should
==
"
f403da73f5e62794a0447aca879360494b08f678
"
}
end
end
describe
"commits_between"
do
describe
"commits_between"
do
let
(
:project
)
{
Factory
:project
}
let
(
:project
)
{
Factory
:project
}
subject
do
subject
do
commits
=
project
.
commits_between
(
"
a6d1d4aca0c85816ddfd27d93773f43a31395033
"
,
commits
=
project
.
commits_between
(
"
3a4b4fb4cde7809f033822a171b9feae19d41fff
"
,
"
2fb376f61875b58bceee0492e270e9c805294b1a
"
)
"
8470d70da67355c9c009e4401746b1d5410af2e3
"
)
commits
.
map
{
|
c
|
c
.
id
}
commits
.
map
{
|
c
|
c
.
id
}
end
end
it
{
should
have
(
2
).
elements
}
it
{
should
have
(
3
).
elements
}
it
{
should
include
(
"2fb376f61875b58bceee0492e270e9c805294b1a"
)
}
it
{
should
include
(
"f0f14c8eaba69ebddd766498a9d0b0e79becd633"
)
}
it
{
should
include
(
"4571e226fbcd7be1af16e9fa1e13b7ac003bebdf"
)
}
it
{
should_not
include
(
"bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a"
)
}
it
{
should_not
include
(
"a6d1d4aca0c85816ddfd27d93773f43a31395033"
)
}
end
end
describe
"Git methods"
do
describe
"Git methods"
do
...
...
spec/requests/admin/admin_projects_spec.rb
View file @
3676838d
...
@@ -87,7 +87,7 @@ describe "Admin::Projects" do
...
@@ -87,7 +87,7 @@ describe "Admin::Projects" do
visit
new_admin_project_path
visit
new_admin_project_path
fill_in
'Name'
,
:with
=>
'NewProject'
fill_in
'Name'
,
:with
=>
'NewProject'
fill_in
'Code'
,
:with
=>
'NPR'
fill_in
'Code'
,
:with
=>
'NPR'
fill_in
'Path'
,
:with
=>
'
legit
_1'
fill_in
'Path'
,
:with
=>
'
gitlabhq
_1'
expect
{
click_button
"Save"
}.
to
change
{
Project
.
count
}.
by
(
1
)
expect
{
click_button
"Save"
}.
to
change
{
Project
.
count
}.
by
(
1
)
@project
=
Project
.
last
@project
=
Project
.
last
end
end
...
...
spec/requests/merge_requests_spec.rb
View file @
3676838d
...
@@ -52,7 +52,7 @@ describe "MergeRequests" do
...
@@ -52,7 +52,7 @@ describe "MergeRequests" do
visit
new_project_merge_request_path
(
project
)
visit
new_project_merge_request_path
(
project
)
fill_in
"merge_request_title"
,
:with
=>
"Merge Request Title"
fill_in
"merge_request_title"
,
:with
=>
"Merge Request Title"
select
"master"
,
:from
=>
"merge_request_source_branch"
select
"master"
,
:from
=>
"merge_request_source_branch"
select
"
master
"
,
:from
=>
"merge_request_target_branch"
select
"
stable
"
,
:from
=>
"merge_request_target_branch"
select
@user
.
name
,
:from
=>
"merge_request_assignee_id"
select
@user
.
name
,
:from
=>
"merge_request_assignee_id"
click_button
"Save"
click_button
"Save"
end
end
...
...
spec/requests/projects_spec.rb
View file @
3676838d
...
@@ -134,7 +134,7 @@ describe "Projects" do
...
@@ -134,7 +134,7 @@ describe "Projects" do
visit
edit_project_path
(
@project
)
visit
edit_project_path
(
@project
)
fill_in
'Name'
,
:with
=>
'Awesome'
fill_in
'Name'
,
:with
=>
'Awesome'
fill_in
'Path'
,
:with
=>
'
legit
'
fill_in
'Path'
,
:with
=>
'
gitlabhq
'
fill_in
'Description'
,
:with
=>
'Awesome project'
fill_in
'Description'
,
:with
=>
'Awesome project'
click_button
"Save"
click_button
"Save"
@project
=
@project
.
reload
@project
=
@project
.
reload
...
...
spec/requests/projects_tree_spec.rb
View file @
3676838d
...
@@ -57,7 +57,7 @@ describe "Projects" do
...
@@ -57,7 +57,7 @@ describe "Projects" do
@project
=
Factory
:project
@project
=
Factory
:project
@project
.
add_access
(
@user
,
:read
)
@project
.
add_access
(
@user
,
:read
)
visit
tree_project_ref_path
(
@project
,
@project
.
root_ref
,
:path
=>
"
.rvmrc
"
)
visit
tree_project_ref_path
(
@project
,
@project
.
root_ref
,
:path
=>
"
Gemfile
"
)
end
end
it
"should be correct path"
do
it
"should be correct path"
do
...
@@ -65,7 +65,7 @@ describe "Projects" do
...
@@ -65,7 +65,7 @@ describe "Projects" do
end
end
it
"should contain file view"
do
it
"should contain file view"
do
page
.
should
have_content
(
"r
vm use 1.9.2@legit
"
)
page
.
should
have_content
(
"r
ubygems.org
"
)
end
end
end
end
end
end
...
...
spec/requests/repositories_spec.rb
View file @
3676838d
...
@@ -42,7 +42,7 @@ describe "Repository" do
...
@@ -42,7 +42,7 @@ describe "Repository" do
it
"should have link to repo activities"
do
it
"should have link to repo activities"
do
page
.
should
have_content
(
"Tags"
)
page
.
should
have_content
(
"Tags"
)
page
.
should
have_content
(
"
No tags
"
)
page
.
should
have_content
(
"
v1.2.1
"
)
end
end
end
end
end
end
...
...
spec/seed_project.tar.gz
View file @
3676838d
No preview for this file type
spec/support/valid_commit.rb
View file @
3676838d
module
ValidCommit
module
ValidCommit
ID
=
"
eaffbe556ec3a8dc84ef15892a9f12d84dde7e1d
"
ID
=
"
8470d70da67355c9c009e4401746b1d5410af2e3
"
MESSAGE
=
"
style
"
MESSAGE
=
"
notes controller refactored
"
AUTHOR_FULL_NAME
=
"Dmitriy Zaporozhets"
AUTHOR_FULL_NAME
=
"Dmitriy Zaporozhets"
FILES
=
[
".
gitignore"
,
".rspec"
,
".rvmrc"
,
"Gemfile"
,
"Gemfile.lock"
,
"LICENSE"
,
"README.rdoc"
,
"Rakefile"
,
"app"
,
"config.ru"
,
"config"
,
"db"
,
"doc"
,
"lib"
,
"log"
,
"public
"
,
"script"
,
"spec"
,
"vendor"
]
FILES
=
[
".
foreman"
,
".gitignore"
,
".rails_footnotes"
,
".rspec"
,
".travis.yml"
,
"CHANGELOG"
,
"Gemfile"
,
"Gemfile.lock"
,
"LICENSE"
,
"Procfile"
,
"Procfile.production"
,
"README.md"
,
"Rakefile"
,
"VERSION"
,
"app"
,
"config.ru"
,
"config"
,
"db"
,
"doc"
,
"lib"
,
"log"
,
"public"
,
"resque.sh
"
,
"script"
,
"spec"
,
"vendor"
]
FILES_COUNT
=
19
FILES_COUNT
=
26
C_FILE_PATH
=
"app/models"
C_FILE_PATH
=
"app/models"
C_FILES
=
[
".gitkeep"
,
"
project.rb"
,
"user
.rb"
]
C_FILES
=
[
".gitkeep"
,
"
ability.rb"
,
"commit.rb"
,
"issue.rb"
,
"key.rb"
,
"mailer_observer.rb"
,
"merge_request.rb"
,
"note.rb"
,
"project.rb"
,
"protected_branch.rb"
,
"repository.rb"
,
"snippet.rb"
,
"tree.rb"
,
"user.rb"
,
"users_project.rb"
,
"web_hook.rb"
,
"wiki
.rb"
]
BLOB_FILE
=
<<-
blob
BLOB_FILE
=
%{%h3= @key.title\n%hr\n%pre= @key.key\n.actions\n = link_to 'Remove', @key, :confirm => 'Are you sure?', :method => :delete, :class => \"btn danger delete-key\"\n\n\n}
<div class="span-14 colborder">
BLOB_FILE_PATH
=
"app/views/keys/show.html.haml"
<h2>Tree / <%= link_to "Commits", project_commits_path(@project) %></h2>
<%= render :partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @commit.tree} %>
</div>
<div class="span-8 right">
<%= render "side_panel" %>
</div>
blob
BLOB_FILE_PATH
=
"app/views/projects/show.html.erb"
end
end
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