#860: merge master into branch
This commit is contained in:
commit
ad08a31e5f
|
@ -1708,3 +1708,12 @@ table#myTable thead tr.search th form.button_to div input {
|
|||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.file-editor {
|
||||
margin-bottom: 10px;
|
||||
margin-top: 10px;
|
||||
max-width: 860px;
|
||||
}
|
||||
|
||||
.CodeMirror {
|
||||
border: 1px solid #DDDDDD;
|
||||
}
|
|
@ -12,8 +12,7 @@ class Platforms::MassBuildsController < Platforms::BaseController
|
|||
def create
|
||||
mass_build = @platform.mass_builds.new(:arches => params[:arches],
|
||||
:auto_publish => params[:auto_publish] || false,
|
||||
:projects_list => params[:projects_list],
|
||||
:new_core => params[:new_core])
|
||||
:projects_list => params[:projects_list])
|
||||
mass_build.user = current_user
|
||||
authorize! :create, mass_build
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ class MassBuild < ActiveRecord::Base
|
|||
scope :outdated, where('created_at < ?', Time.now + 1.day - BuildList::MAX_LIVE_TIME)
|
||||
|
||||
attr_accessor :arches
|
||||
attr_accessible :arches, :auto_publish, :projects_list, :new_core
|
||||
attr_accessible :arches, :auto_publish, :projects_list
|
||||
|
||||
validates :platform_id, :arch_names, :name, :user_id, :projects_list, :presence => true
|
||||
validates_inclusion_of :auto_publish, :in => [true, false]
|
||||
|
@ -21,7 +21,9 @@ class MassBuild < ActiveRecord::Base
|
|||
:build_pending,
|
||||
:build_started,
|
||||
:build_publish,
|
||||
:build_error
|
||||
:build_error,
|
||||
:success,
|
||||
:build_canceled
|
||||
]
|
||||
|
||||
def build_all
|
||||
|
@ -38,7 +40,7 @@ class MassBuild < ActiveRecord::Base
|
|||
return if self.reload.stop_build
|
||||
arches_list.each do |arch|
|
||||
rep = (project.repositories & platform.repositories).first
|
||||
project.build_for(platform, rep.id, user, arch, auto_publish, self.id, 0, new_core)
|
||||
project.build_for(platform, rep.id, user, arch, auto_publish, self.id, 0)
|
||||
end
|
||||
rescue RuntimeError, Exception
|
||||
end
|
||||
|
@ -47,7 +49,6 @@ class MassBuild < ActiveRecord::Base
|
|||
list = (missed_projects_list || '') << "#{name}\n"
|
||||
update_column :missed_projects_list, list
|
||||
end
|
||||
sleep 1 unless new_core
|
||||
end
|
||||
end
|
||||
later :build_all, :queue => :clone_build
|
||||
|
|
|
@ -130,7 +130,7 @@ class Project < ActiveRecord::Base
|
|||
#path #share by NFS
|
||||
end
|
||||
|
||||
def build_for(platform, repository_id, user, arch = Arch.find_by_name('i586'), auto_publish = false, mass_build_id = nil, priority = 0, new_core = false)
|
||||
def build_for(platform, repository_id, user, arch = Arch.find_by_name('i586'), auto_publish = false, mass_build_id = nil, priority = 0)
|
||||
# Select main and project platform repository(contrib, non-free and etc)
|
||||
# If main does not exist, will connect only project platform repository
|
||||
# If project platform repository is main, only main will be connect
|
||||
|
@ -151,7 +151,6 @@ class Project < ActiveRecord::Base
|
|||
bl.priority = priority
|
||||
bl.mass_build_id = mass_build_id
|
||||
bl.save_to_repository_id = repository_id
|
||||
bl.new_core = new_core
|
||||
end
|
||||
build_list.save
|
||||
end
|
||||
|
|
|
@ -48,6 +48,11 @@ class PullRequest < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def check(do_transaction = true)
|
||||
if do_transaction && !valid?
|
||||
issue.set_close nil
|
||||
issue.save(:validate => false) # FIXME remove this hack
|
||||
return false
|
||||
end
|
||||
res = merge
|
||||
new_status = case res
|
||||
when /Already up-to-date/
|
||||
|
@ -171,16 +176,18 @@ class PullRequest < ActiveRecord::Base
|
|||
end
|
||||
|
||||
Dir.chdir(path) do
|
||||
system 'git', 'tag', '-d', from_ref, to_ref
|
||||
system 'git fetch --tags'
|
||||
tags, head = repo.tags.map(&:name), to_project == from_project ? 'origin' : 'head'
|
||||
unless tags.include? to_ref
|
||||
system 'git', 'checkout', to_ref
|
||||
system 'git', 'pull', 'origin', to_ref
|
||||
if to_project_id == from_project_id
|
||||
system 'git', 'checkout', from_ref
|
||||
system 'git', 'pull', 'origin', from_ref
|
||||
else
|
||||
system 'git', 'fetch', 'head', "+#{from_ref}:#{from_branch}"
|
||||
system 'git', 'reset', '--hard', "origin/#{to_ref}"
|
||||
end
|
||||
unless tags.include? from_ref
|
||||
system 'git', 'branch', '-D', from_branch
|
||||
system 'git', 'fetch', head, "+#{from_ref}:#{from_branch}"
|
||||
end
|
||||
end
|
||||
# TODO catch errors
|
||||
end
|
||||
|
||||
def clean
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
.both
|
||||
|
||||
= form_tag edit_blob_path(@project, @treeish, @path), :name => 'blob-editor', :method => :put do
|
||||
.file= text_area_tag :content, @blob.data, :id => 'code'
|
||||
.file-editor= text_area_tag :content, @blob.data, :id => 'code'
|
||||
|
||||
.both
|
||||
= t("layout.enter_commit_message")
|
||||
|
@ -23,4 +23,12 @@
|
|||
lineNumbers: true,
|
||||
mode: '#{@blob.raw_mime_type.content_type}'
|
||||
});
|
||||
$(".CodeMirror").resizable({
|
||||
stop: function() { editor.refresh(); },
|
||||
resize: function() {
|
||||
$(".CodeMirror-scroll").height($(this).height());
|
||||
$(".CodeMirror-scroll").width($(this).width());
|
||||
editor.refresh();
|
||||
}
|
||||
});
|
||||
});
|
|
@ -0,0 +1,13 @@
|
|||
class AddCountersToMassBuild < ActiveRecord::Migration
|
||||
def up
|
||||
add_column :mass_builds, :success_count, :integer, :default => 0, :null => false
|
||||
add_column :mass_builds, :build_canceled_count, :integer, :default => 0, :null => false
|
||||
change_column :mass_builds, :new_core, :boolean, :default => true
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :mass_builds, :success_count
|
||||
remove_column :mass_builds, :build_canceled_count
|
||||
change_column :mass_builds, :new_core, :boolean, :default => false
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20130128123151) do
|
||||
ActiveRecord::Schema.define(:version => 20130129145833) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -266,7 +266,9 @@ ActiveRecord::Schema.define(:version => 20130128123151) do
|
|||
t.text "projects_list"
|
||||
t.integer "missed_projects_count", :default => 0, :null => false
|
||||
t.text "missed_projects_list"
|
||||
t.boolean "new_core", :default => false
|
||||
t.boolean "new_core", :default => true
|
||||
t.integer "success_count", :default => 0, :null => false
|
||||
t.integer "build_canceled_count", :default => 0, :null => false
|
||||
end
|
||||
|
||||
create_table "platforms", :force => true do |t|
|
||||
|
|
|
@ -27,13 +27,13 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|||
|
||||
def start_workers
|
||||
queue = [
|
||||
:publish_observer,
|
||||
:rpm_worker_observer,
|
||||
:iso_worker_observer,
|
||||
:fork_import,
|
||||
:hook,
|
||||
:clone_build,
|
||||
:notification,
|
||||
:iso_worker_observer,
|
||||
:rpm_worker_observer,
|
||||
:publish_observer
|
||||
:notification
|
||||
].join(',')
|
||||
run "cd #{fetch :current_path} && COUNT=#{workers_count} QUEUE=#{queue} #{rails_env} BACKGROUND=yes bundle exec rake resque:workers"
|
||||
end
|
||||
|
|
|
@ -96,6 +96,22 @@ describe PullRequest do
|
|||
@wrong_pull.save
|
||||
@project.pull_requests.joins(:issue).where(:issues => {:title => @wrong_pull.title}).count.should == 0
|
||||
end
|
||||
|
||||
it "should create pull with tag" do
|
||||
system("cd #{@project.path} && git tag 4.7.5.3 $(git rev-parse #{@pull.from_ref})") # TODO REDO through grit
|
||||
@pull = @project.pull_requests.new(:issue_attributes => {:title => 'tag', :body => 'testing'})
|
||||
@pull.issue.user, @pull.issue.project = @user, @pull.to_project
|
||||
@pull.to_ref = 'master'
|
||||
@pull.from_project, @pull.from_ref = @project, '4.7.5.3'
|
||||
@pull.save
|
||||
@project.pull_requests.joins(:issue).where(:issues => {:title => @pull.title}).count.should == 1
|
||||
end
|
||||
|
||||
it "should close pull when deleting from branch" do
|
||||
system("cd #{@project.path} && git branch -D #{@pull.from_branch}")
|
||||
@pull.check
|
||||
@project.pull_requests.joins(:issue).where(:issues => {:title => @pull.title, :status => 'closed'}).count.should == 1
|
||||
end
|
||||
end
|
||||
|
||||
before do
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
.CodeMirror-scroll {
|
||||
overflow: auto;
|
||||
height: 300px;
|
||||
/* This is needed to prevent an IE[67] bug where the scrolled content
|
||||
is visible outside of the scrolling box. */
|
||||
position: relative;
|
||||
|
|
Loading…
Reference in New Issue