Commit 3676838dc96bbe1c8c7eec7e6ca545c462dfc12d
1 parent
781f5aa6
Exists in
master
and in
4 other branches
Rspec test repo replaced.\nMerge Requests improved
Showing
18 changed files
with
90 additions
and
41 deletions
Show diff stats
app/assets/stylesheets/common.scss
@@ -531,7 +531,7 @@ table a code { | @@ -531,7 +531,7 @@ table a code { | ||
531 | 531 | ||
532 | /** FLASH message **/ | 532 | /** FLASH message **/ |
533 | #flash_container { | 533 | #flash_container { |
534 | - height:45px; | 534 | + height:50px; |
535 | position:fixed; | 535 | position:fixed; |
536 | z-index:10001; | 536 | z-index:10001; |
537 | top:0px; | 537 | top:0px; |
@@ -540,7 +540,7 @@ table a code { | @@ -540,7 +540,7 @@ table a code { | ||
540 | overflow:hidden; | 540 | overflow:hidden; |
541 | background:white; | 541 | background:white; |
542 | cursor:pointer; | 542 | cursor:pointer; |
543 | - border-bottom:1px solid #777; | 543 | + border-bottom:1px solid #ccc; |
544 | 544 | ||
545 | h4 { | 545 | h4 { |
546 | color:#444; | 546 | color:#444; |
@@ -901,3 +901,23 @@ p.time { | @@ -901,3 +901,23 @@ p.time { | ||
901 | margin:2px; | 901 | margin:2px; |
902 | } | 902 | } |
903 | } | 903 | } |
904 | + | ||
905 | +.mr_source_commit , | ||
906 | +.mr_target_commit { | ||
907 | + .commit { | ||
908 | + list-style:none; | ||
909 | + margin-top:10px; | ||
910 | + &:hover { | ||
911 | + background:none; | ||
912 | + } | ||
913 | + } | ||
914 | +} | ||
915 | + | ||
916 | +.prettyprint { | ||
917 | + background-color: #fefbf3; | ||
918 | + padding: 9px; | ||
919 | + border: 1px solid rgba(0,0,0,.2); | ||
920 | + -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.1); | ||
921 | + -moz-box-shadow: 0 1px 2px rgba(0,0,0,.1); | ||
922 | + box-shadow: 0 1px 2px rgba(0,0,0,.1); | ||
923 | +} |
app/controllers/merge_requests_controller.rb
@@ -106,6 +106,14 @@ class MergeRequestsController < ApplicationController | @@ -106,6 +106,14 @@ class MergeRequestsController < ApplicationController | ||
106 | end | 106 | end |
107 | end | 107 | end |
108 | 108 | ||
109 | + def branch_from | ||
110 | + @commit = project.commit(params[:ref]) | ||
111 | + end | ||
112 | + | ||
113 | + def branch_to | ||
114 | + @commit = project.commit(params[:ref]) | ||
115 | + end | ||
116 | + | ||
109 | protected | 117 | protected |
110 | 118 | ||
111 | def merge_request | 119 | def merge_request |
app/models/merge_request.rb
@@ -12,6 +12,7 @@ class MergeRequest < ActiveRecord::Base | @@ -12,6 +12,7 @@ class MergeRequest < ActiveRecord::Base | ||
12 | validates_presence_of :author_id | 12 | validates_presence_of :author_id |
13 | validates_presence_of :source_branch | 13 | validates_presence_of :source_branch |
14 | validates_presence_of :target_branch | 14 | validates_presence_of :target_branch |
15 | + validate :validate_branches | ||
15 | 16 | ||
16 | delegate :name, | 17 | delegate :name, |
17 | :email, | 18 | :email, |
@@ -31,6 +32,13 @@ class MergeRequest < ActiveRecord::Base | @@ -31,6 +32,13 @@ class MergeRequest < ActiveRecord::Base | ||
31 | scope :closed, where(:closed => true) | 32 | scope :closed, where(:closed => true) |
32 | scope :assigned, lambda { |u| where(:assignee_id => u.id)} | 33 | scope :assigned, lambda { |u| where(:assignee_id => u.id)} |
33 | 34 | ||
35 | + | ||
36 | + def validate_branches | ||
37 | + if target_branch == source_branch | ||
38 | + errors.add :base, "You can not use same branch for source and target branches" | ||
39 | + end | ||
40 | + end | ||
41 | + | ||
34 | def new? | 42 | def new? |
35 | today? && created_at == updated_at | 43 | today? && created_at == updated_at |
36 | end | 44 | end |
app/views/merge_requests/_form.html.haml
@@ -10,10 +10,14 @@ | @@ -10,10 +10,14 @@ | ||
10 | .input= f.text_area :title, :class => "xxlarge", :maxlength => 255, :rows => 5 | 10 | .input= f.text_area :title, :class => "xxlarge", :maxlength => 255, :rows => 5 |
11 | .clearfix | 11 | .clearfix |
12 | = f.label :source_branch, "From" | 12 | = f.label :source_branch, "From" |
13 | - .input= f.select(:source_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }, :style => "width:250px") | 13 | + .input |
14 | + = f.select(:source_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }, :style => "width:250px") | ||
15 | + .mr_source_commit | ||
14 | .clearfix | 16 | .clearfix |
15 | = f.label :target_branch, "To" | 17 | = f.label :target_branch, "To" |
16 | - .input= f.select(:target_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }, :style => "width:250px") | 18 | + .input |
19 | + = f.select(:target_branch, @project.heads.map(&:name), { :include_blank => "Select branch" }, :style => "width:250px") | ||
20 | + .mr_target_commit | ||
17 | .clearfix | 21 | .clearfix |
18 | = f.label :assignee_id, "Assign to" | 22 | = f.label :assignee_id, "Assign to" |
19 | .input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, :style => "width:250px") | 23 | .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 @@ | ||
34 | $('select#merge_request_assignee_id').chosen(); | 38 | $('select#merge_request_assignee_id').chosen(); |
35 | $('select#merge_request_source_branch').chosen(); | 39 | $('select#merge_request_source_branch').chosen(); |
36 | $('select#merge_request_target_branch').chosen(); | 40 | $('select#merge_request_target_branch').chosen(); |
41 | + | ||
42 | + | ||
43 | + | ||
44 | + $("#merge_request_source_branch").live("change", function() { | ||
45 | + $.get("#{branch_from_project_merge_requests_path(@project)}", {ref: $(this).val() }); | ||
46 | + }); | ||
47 | + | ||
48 | + $("#merge_request_target_branch").live("change", function() { | ||
49 | + $.get("#{branch_to_project_merge_requests_path(@project)}", {ref: $(this).val() }); | ||
50 | + }); | ||
37 | }); | 51 | }); |
38 | 52 |
config/routes.rb
@@ -101,6 +101,11 @@ Gitlab::Application.routes.draw do | @@ -101,6 +101,11 @@ Gitlab::Application.routes.draw do | ||
101 | member do | 101 | member do |
102 | get :diffs | 102 | get :diffs |
103 | end | 103 | end |
104 | + | ||
105 | + collection do | ||
106 | + get :branch_from | ||
107 | + get :branch_to | ||
108 | + end | ||
104 | end | 109 | end |
105 | 110 | ||
106 | resources :snippets | 111 | resources :snippets |
db/fixtures/test/001_repo.rb
@@ -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) | ||
10 | Dir.chdir(repo_dir) | 10 | Dir.chdir(repo_dir) |
11 | `tar -xf seed_project.tar.gz` | 11 | `tar -xf seed_project.tar.gz` |
12 | 3.times do |i| | 12 | 3.times do |i| |
13 | -`cp -r legit/ legit_#{i}/` | ||
14 | -puts "Unpacked seed repo - tmp/tests/legit_#{i}" | 13 | +`cp -r gitlabhq/ gitlabhq_#{i}/` |
14 | +puts "Unpacked seed repo - tmp/tests/gitlabhq_#{i}" | ||
15 | end | 15 | end |
spec/factories.rb
@@ -2,14 +2,14 @@ require File.join(Rails.root, 'spec', 'factory') | @@ -2,14 +2,14 @@ require File.join(Rails.root, 'spec', 'factory') | ||
2 | 2 | ||
3 | Factory.add(:project, Project) do |obj| | 3 | Factory.add(:project, Project) do |obj| |
4 | obj.name = Faker::Internet.user_name | 4 | obj.name = Faker::Internet.user_name |
5 | - obj.path = 'legit' | 5 | + obj.path = 'gitlabhq' |
6 | obj.owner = Factory(:user) | 6 | obj.owner = Factory(:user) |
7 | obj.code = 'LGT' | 7 | obj.code = 'LGT' |
8 | end | 8 | end |
9 | 9 | ||
10 | Factory.add(:public_project, Project) do |obj| | 10 | Factory.add(:public_project, Project) do |obj| |
11 | obj.name = Faker::Internet.user_name | 11 | obj.name = Faker::Internet.user_name |
12 | - obj.path = 'legit' | 12 | + obj.path = 'gitlabhq' |
13 | obj.private_flag = false | 13 | obj.private_flag = false |
14 | obj.owner = Factory(:user) | 14 | obj.owner = Factory(:user) |
15 | obj.code = 'LGT' | 15 | 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| | ||
41 | obj.author = Factory :user | 41 | obj.author = Factory :user |
42 | obj.assignee = Factory :user | 42 | obj.assignee = Factory :user |
43 | obj.source_branch = "master" | 43 | obj.source_branch = "master" |
44 | - obj.target_branch = "master" | 44 | + obj.target_branch = "stable" |
45 | obj.closed = false | 45 | obj.closed = false |
46 | end | 46 | end |
47 | 47 |
spec/models/note_spec.rb
@@ -54,7 +54,7 @@ describe Note do | @@ -54,7 +54,7 @@ describe Note do | ||
54 | describe :authorization do | 54 | describe :authorization do |
55 | before do | 55 | before do |
56 | @p1 = project | 56 | @p1 = project |
57 | - @p2 = Factory :project, :code => "alien", :path => "legit_1" | 57 | + @p2 = Factory :project, :code => "alien", :path => "gitlabhq_1" |
58 | @u1 = Factory :user | 58 | @u1 = Factory :user |
59 | @u2 = Factory :user | 59 | @u2 = Factory :user |
60 | @u3 = Factory :user | 60 | @u3 = Factory :user |
spec/models/project_spec.rb
@@ -86,23 +86,22 @@ describe Project do | @@ -86,23 +86,22 @@ describe Project do | ||
86 | let(:project) { Factory :project } | 86 | let(:project) { Factory :project } |
87 | 87 | ||
88 | it { project.fresh_commits(3).count.should == 3 } | 88 | it { project.fresh_commits(3).count.should == 3 } |
89 | - it { project.fresh_commits.first.id.should == "2fb376f61875b58bceee0492e270e9c805294b1a" } | ||
90 | - it { project.fresh_commits.last.id.should == "0dac878dbfe0b9c6104a87d65fe999149a8d862c" } | 89 | + it { project.fresh_commits.first.id.should == "bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a" } |
90 | + it { project.fresh_commits.last.id.should == "f403da73f5e62794a0447aca879360494b08f678" } | ||
91 | end | 91 | end |
92 | 92 | ||
93 | describe "commits_between" do | 93 | describe "commits_between" do |
94 | let(:project) { Factory :project } | 94 | let(:project) { Factory :project } |
95 | 95 | ||
96 | subject do | 96 | subject do |
97 | - commits = project.commits_between("a6d1d4aca0c85816ddfd27d93773f43a31395033", | ||
98 | - "2fb376f61875b58bceee0492e270e9c805294b1a") | 97 | + commits = project.commits_between("3a4b4fb4cde7809f033822a171b9feae19d41fff", |
98 | + "8470d70da67355c9c009e4401746b1d5410af2e3") | ||
99 | commits.map { |c| c.id } | 99 | commits.map { |c| c.id } |
100 | end | 100 | end |
101 | 101 | ||
102 | - it { should have(2).elements } | ||
103 | - it { should include("2fb376f61875b58bceee0492e270e9c805294b1a") } | ||
104 | - it { should include("4571e226fbcd7be1af16e9fa1e13b7ac003bebdf") } | ||
105 | - it { should_not include("a6d1d4aca0c85816ddfd27d93773f43a31395033") } | 102 | + it { should have(3).elements } |
103 | + it { should include("f0f14c8eaba69ebddd766498a9d0b0e79becd633") } | ||
104 | + it { should_not include("bcf03b5de6c33f3869ef70d68cf06e679d1d7f9a") } | ||
106 | end | 105 | end |
107 | 106 | ||
108 | describe "Git methods" do | 107 | describe "Git methods" do |
spec/requests/admin/admin_projects_spec.rb
@@ -87,7 +87,7 @@ describe "Admin::Projects" do | @@ -87,7 +87,7 @@ describe "Admin::Projects" do | ||
87 | visit new_admin_project_path | 87 | visit new_admin_project_path |
88 | fill_in 'Name', :with => 'NewProject' | 88 | fill_in 'Name', :with => 'NewProject' |
89 | fill_in 'Code', :with => 'NPR' | 89 | fill_in 'Code', :with => 'NPR' |
90 | - fill_in 'Path', :with => 'legit_1' | 90 | + fill_in 'Path', :with => 'gitlabhq_1' |
91 | expect { click_button "Save" }.to change { Project.count }.by(1) | 91 | expect { click_button "Save" }.to change { Project.count }.by(1) |
92 | @project = Project.last | 92 | @project = Project.last |
93 | end | 93 | end |
spec/requests/merge_requests_spec.rb
@@ -52,7 +52,7 @@ describe "MergeRequests" do | @@ -52,7 +52,7 @@ describe "MergeRequests" do | ||
52 | visit new_project_merge_request_path(project) | 52 | visit new_project_merge_request_path(project) |
53 | fill_in "merge_request_title", :with => "Merge Request Title" | 53 | fill_in "merge_request_title", :with => "Merge Request Title" |
54 | select "master", :from => "merge_request_source_branch" | 54 | select "master", :from => "merge_request_source_branch" |
55 | - select "master", :from => "merge_request_target_branch" | 55 | + select "stable", :from => "merge_request_target_branch" |
56 | select @user.name, :from => "merge_request_assignee_id" | 56 | select @user.name, :from => "merge_request_assignee_id" |
57 | click_button "Save" | 57 | click_button "Save" |
58 | end | 58 | end |
spec/requests/projects_spec.rb
@@ -134,7 +134,7 @@ describe "Projects" do | @@ -134,7 +134,7 @@ describe "Projects" do | ||
134 | visit edit_project_path(@project) | 134 | visit edit_project_path(@project) |
135 | 135 | ||
136 | fill_in 'Name', :with => 'Awesome' | 136 | fill_in 'Name', :with => 'Awesome' |
137 | - fill_in 'Path', :with => 'legit' | 137 | + fill_in 'Path', :with => 'gitlabhq' |
138 | fill_in 'Description', :with => 'Awesome project' | 138 | fill_in 'Description', :with => 'Awesome project' |
139 | click_button "Save" | 139 | click_button "Save" |
140 | @project = @project.reload | 140 | @project = @project.reload |
spec/requests/projects_tree_spec.rb
@@ -57,7 +57,7 @@ describe "Projects" do | @@ -57,7 +57,7 @@ describe "Projects" do | ||
57 | @project = Factory :project | 57 | @project = Factory :project |
58 | @project.add_access(@user, :read) | 58 | @project.add_access(@user, :read) |
59 | 59 | ||
60 | - visit tree_project_ref_path(@project, @project.root_ref, :path => ".rvmrc") | 60 | + visit tree_project_ref_path(@project, @project.root_ref, :path => "Gemfile") |
61 | end | 61 | end |
62 | 62 | ||
63 | it "should be correct path" do | 63 | it "should be correct path" do |
@@ -65,7 +65,7 @@ describe "Projects" do | @@ -65,7 +65,7 @@ describe "Projects" do | ||
65 | end | 65 | end |
66 | 66 | ||
67 | it "should contain file view" do | 67 | it "should contain file view" do |
68 | - page.should have_content("rvm use 1.9.2@legit") | 68 | + page.should have_content("rubygems.org") |
69 | end | 69 | end |
70 | end | 70 | end |
71 | end | 71 | end |
spec/requests/repositories_spec.rb
@@ -42,7 +42,7 @@ describe "Repository" do | @@ -42,7 +42,7 @@ describe "Repository" do | ||
42 | 42 | ||
43 | it "should have link to repo activities" do | 43 | it "should have link to repo activities" do |
44 | page.should have_content("Tags") | 44 | page.should have_content("Tags") |
45 | - page.should have_content("No tags") | 45 | + page.should have_content("v1.2.1") |
46 | end | 46 | end |
47 | end | 47 | end |
48 | end | 48 | end |
spec/seed_project.tar.gz
No preview for this file type
spec/support/valid_commit.rb
1 | module ValidCommit | 1 | module ValidCommit |
2 | - ID = "eaffbe556ec3a8dc84ef15892a9f12d84dde7e1d" | ||
3 | - MESSAGE = "style" | 2 | + ID = "8470d70da67355c9c009e4401746b1d5410af2e3" |
3 | + MESSAGE = "notes controller refactored" | ||
4 | AUTHOR_FULL_NAME = "Dmitriy Zaporozhets" | 4 | AUTHOR_FULL_NAME = "Dmitriy Zaporozhets" |
5 | 5 | ||
6 | - FILES = [".gitignore", ".rspec", ".rvmrc", "Gemfile", "Gemfile.lock", "LICENSE", "README.rdoc", "Rakefile", "app", "config.ru", "config", "db", "doc", "lib", "log", "public", "script", "spec", "vendor"] | ||
7 | - FILES_COUNT = 19 | 6 | + 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"] |
7 | + FILES_COUNT = 26 | ||
8 | 8 | ||
9 | C_FILE_PATH = "app/models" | 9 | C_FILE_PATH = "app/models" |
10 | - C_FILES = [".gitkeep", "project.rb", "user.rb"] | 10 | + 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"] |
11 | 11 | ||
12 | - BLOB_FILE = <<-blob | ||
13 | -<div class="span-14 colborder"> | ||
14 | - <h2>Tree / <%= link_to "Commits", project_commits_path(@project) %></h2> | ||
15 | - <%= render :partial => "tree", :locals => {:repo => @repo, :commit => @commit, :tree => @commit.tree} %> | ||
16 | -</div> | ||
17 | - | ||
18 | -<div class="span-8 right"> | ||
19 | - <%= render "side_panel" %> | ||
20 | -</div> | ||
21 | -blob | ||
22 | - | ||
23 | - BLOB_FILE_PATH = "app/views/projects/show.html.erb" | 12 | + 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} |
13 | + BLOB_FILE_PATH = "app/views/keys/show.html.haml" | ||
24 | end | 14 | end |
25 | 15 |