[refs #674] add diff to build lists
This commit is contained in:
parent
0669fb2789
commit
ec6279d803
|
@ -37,8 +37,13 @@ module BuildListsHelper
|
|||
|
||||
def build_list_version_link(bl, str_version = false)
|
||||
if bl.commit_hash.present?
|
||||
link_to str_version ? "#{shortest_hash_id bl.commit_hash} ( #{bl.project_version} )" : shortest_hash_id(bl.commit_hash),
|
||||
commit_path(bl.project.owner, bl.project, bl.commit_hash)
|
||||
if bl.last_published_commit_hash.present?
|
||||
link_to "#{t('diff')} #{shortest_hash_id bl.last_published_commit_hash}...#{shortest_hash_id bl.commit_hash} ( #{bl.project_version} )",
|
||||
diff_path(bl.project.owner, bl.project, bl.last_published_commit_hash) + "...#{bl.commit_hash}"
|
||||
else
|
||||
link_to str_version ? "#{shortest_hash_id bl.commit_hash} ( #{bl.project_version} )" : shortest_hash_id(bl.commit_hash),
|
||||
commit_path(bl.project.owner, bl.project, bl.commit_hash)
|
||||
end
|
||||
else
|
||||
bl.project_version
|
||||
end
|
||||
|
|
|
@ -214,14 +214,9 @@ class BuildList < ActiveRecord::Base
|
|||
|
||||
def actualize_packages
|
||||
ActiveRecord::Base.transaction do
|
||||
old_pkgs = self.class.where(:project_id => self.project_id)
|
||||
.where(:save_to_repository_id => self.save_to_repository_id)
|
||||
.for_platform(self.build_for_platform_id)
|
||||
.scoped_to_arch(self.arch_id)
|
||||
.for_status(BUILD_PUBLISHED)
|
||||
.recent.limit(2).last.packages # packages from previous build_list
|
||||
old_pkgs.update_all(:actual => false)
|
||||
self.packages.update_all(:actual => true)
|
||||
# packages from previous build_list
|
||||
self.last_published.packages.update_all :actual => false
|
||||
self.packages.update_all :actual => true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -345,4 +340,13 @@ class BuildList < ActiveRecord::Base
|
|||
yield p
|
||||
end
|
||||
end
|
||||
|
||||
def last_published
|
||||
BuildList.where(:project_id => self.project_id,
|
||||
:save_to_repository_id => self.save_to_repository_id)
|
||||
.for_platform(self.build_for_platform_id)
|
||||
.scoped_to_arch(self.arch_id)
|
||||
.for_status(BUILD_PUBLISHED)
|
||||
.recent.limit(2).last
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddLastPublishedCommitHashToBuildList < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :build_lists, :last_published_commit_hash, :string
|
||||
end
|
||||
end
|
165
db/schema.rb
165
db/schema.rb
|
@ -11,14 +11,14 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20121106113338) do
|
||||
ActiveRecord::Schema.define(:version => 20121203142727) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
t.string "kind"
|
||||
t.text "data"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "advisories", :force => true do |t|
|
||||
|
@ -53,8 +53,8 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
|
||||
create_table "arches", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "arches", ["name"], :name => "index_arches_on_name", :unique => true
|
||||
|
@ -63,8 +63,8 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
t.integer "user_id"
|
||||
t.string "provider"
|
||||
t.string "uid"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "authentications", ["provider", "uid"], :name => "index_authentications_on_provider_and_uid", :unique => true
|
||||
|
@ -75,8 +75,8 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
t.integer "level"
|
||||
t.integer "status"
|
||||
t.integer "build_list_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "version"
|
||||
end
|
||||
|
||||
|
@ -110,26 +110,27 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
t.integer "project_id"
|
||||
t.integer "arch_id"
|
||||
t.datetime "notified_at"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.boolean "is_circle", :default => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.boolean "is_circle", :default => false
|
||||
t.text "additional_repos"
|
||||
t.string "name"
|
||||
t.boolean "build_requires", :default => false
|
||||
t.boolean "build_requires", :default => false
|
||||
t.string "update_type"
|
||||
t.integer "build_for_platform_id"
|
||||
t.integer "save_to_platform_id"
|
||||
t.text "include_repos"
|
||||
t.integer "user_id"
|
||||
t.boolean "auto_publish", :default => true
|
||||
t.boolean "auto_publish", :default => true
|
||||
t.string "package_version"
|
||||
t.string "commit_hash"
|
||||
t.integer "priority", :default => 0, :null => false
|
||||
t.integer "priority", :default => 0, :null => false
|
||||
t.datetime "started_at"
|
||||
t.integer "duration"
|
||||
t.integer "advisory_id"
|
||||
t.integer "mass_build_id"
|
||||
t.integer "save_to_repository_id"
|
||||
t.string "last_published_commit_hash"
|
||||
end
|
||||
|
||||
add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id"
|
||||
|
@ -142,8 +143,8 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
t.string "commentable_type"
|
||||
t.integer "user_id"
|
||||
t.text "body"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.decimal "commentable_id", :precision => 50, :scale => 0
|
||||
t.integer "project_id"
|
||||
t.text "data"
|
||||
|
@ -161,8 +162,8 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
t.string "controller"
|
||||
t.string "action"
|
||||
t.text "message"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "flash_notifies", :force => true do |t|
|
||||
|
@ -176,8 +177,8 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
|
||||
create_table "groups", :force => true do |t|
|
||||
t.integer "owner_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "uname"
|
||||
t.integer "own_projects_count", :default => 0, :null => false
|
||||
t.text "description"
|
||||
|
@ -194,8 +195,8 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
t.string "title"
|
||||
t.text "body"
|
||||
t.string "status", :default => "open"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "user_id"
|
||||
t.datetime "closed_at"
|
||||
t.integer "closed_by"
|
||||
|
@ -251,18 +252,60 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
t.boolean "stop_build", :default => false, :null => false
|
||||
end
|
||||
|
||||
create_table "oauth_access_grants", :force => true do |t|
|
||||
t.integer "resource_owner_id", :null => false
|
||||
t.integer "application_id", :null => false
|
||||
t.string "token", :null => false
|
||||
t.integer "expires_in", :null => false
|
||||
t.string "redirect_uri", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "revoked_at"
|
||||
t.string "scopes"
|
||||
end
|
||||
|
||||
add_index "oauth_access_grants", ["token"], :name => "index_oauth_access_grants_on_token", :unique => true
|
||||
|
||||
create_table "oauth_access_tokens", :force => true do |t|
|
||||
t.integer "resource_owner_id"
|
||||
t.integer "application_id", :null => false
|
||||
t.string "token", :null => false
|
||||
t.string "refresh_token"
|
||||
t.integer "expires_in"
|
||||
t.datetime "revoked_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.string "scopes"
|
||||
end
|
||||
|
||||
add_index "oauth_access_tokens", ["refresh_token"], :name => "index_oauth_access_tokens_on_refresh_token", :unique => true
|
||||
add_index "oauth_access_tokens", ["resource_owner_id"], :name => "index_oauth_access_tokens_on_resource_owner_id"
|
||||
add_index "oauth_access_tokens", ["token"], :name => "index_oauth_access_tokens_on_token", :unique => true
|
||||
|
||||
create_table "oauth_applications", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.string "uid", :null => false
|
||||
t.string "secret", :null => false
|
||||
t.string "redirect_uri", :null => false
|
||||
t.integer "owner_id"
|
||||
t.string "owner_type"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "oauth_applications", ["owner_id", "owner_type"], :name => "index_oauth_applications_on_owner_id_and_owner_type"
|
||||
add_index "oauth_applications", ["uid"], :name => "index_oauth_applications_on_uid", :unique => true
|
||||
|
||||
create_table "platforms", :force => true do |t|
|
||||
t.string "description"
|
||||
t.string "name", :null => false
|
||||
t.integer "parent_platform_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.boolean "released", :default => false, :null => false
|
||||
t.integer "owner_id"
|
||||
t.string "owner_type"
|
||||
t.string "visibility", :default => "open", :null => false
|
||||
t.string "platform_type", :default => "main", :null => false
|
||||
t.string "distrib_type", :null => false
|
||||
t.string "distrib_type"
|
||||
end
|
||||
|
||||
add_index "platforms", ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false
|
||||
|
@ -271,16 +314,16 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
t.integer "platform_id"
|
||||
t.string "login"
|
||||
t.string "password"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "user_id"
|
||||
end
|
||||
|
||||
create_table "product_build_lists", :force => true do |t|
|
||||
t.integer "product_id"
|
||||
t.integer "status", :default => 2, :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "project_id"
|
||||
t.string "project_version"
|
||||
t.string "commit_hash"
|
||||
|
@ -296,8 +339,8 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
create_table "products", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.integer "platform_id", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.text "description"
|
||||
t.integer "project_id"
|
||||
t.string "params"
|
||||
|
@ -310,8 +353,8 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
t.string "name"
|
||||
t.string "version"
|
||||
t.datetime "file_mtime"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "platform_id"
|
||||
end
|
||||
|
||||
|
@ -320,25 +363,25 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
create_table "project_to_repositories", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.integer "repository_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "projects", :force => true do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "owner_id"
|
||||
t.string "owner_type"
|
||||
t.string "visibility", :default => "open"
|
||||
t.text "description"
|
||||
t.string "ancestry"
|
||||
t.boolean "has_issues", :default => true
|
||||
t.boolean "has_wiki", :default => false
|
||||
t.string "srpm_file_name"
|
||||
t.string "srpm_content_type"
|
||||
t.integer "srpm_file_size"
|
||||
t.datetime "srpm_updated_at"
|
||||
t.string "srpm_content_type"
|
||||
t.boolean "has_wiki", :default => false
|
||||
t.string "default_branch", :default => "master"
|
||||
t.boolean "is_package", :default => true, :null => false
|
||||
t.integer "average_build_time", :default => 0, :null => false
|
||||
|
@ -368,8 +411,8 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
t.string "token"
|
||||
t.boolean "approved", :default => false
|
||||
t.boolean "rejected", :default => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "interest"
|
||||
t.text "more"
|
||||
t.string "language"
|
||||
|
@ -383,16 +426,16 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
t.string "actor_type"
|
||||
t.integer "target_id"
|
||||
t.string "target_type"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "role"
|
||||
end
|
||||
|
||||
create_table "repositories", :force => true do |t|
|
||||
t.string "description", :null => false
|
||||
t.integer "platform_id", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "name", :null => false
|
||||
t.boolean "publish_without_qa", :default => true
|
||||
end
|
||||
|
@ -404,8 +447,8 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
t.boolean "new_comment_reply", :default => true
|
||||
t.boolean "new_issue", :default => true
|
||||
t.boolean "issue_assign", :default => true
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.boolean "new_comment_commit_owner", :default => true
|
||||
t.boolean "new_comment_commit_repo_owner", :default => true
|
||||
t.boolean "new_comment_commit_commentor", :default => true
|
||||
|
@ -416,8 +459,8 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
create_table "subscribes", :force => true do |t|
|
||||
t.string "subscribeable_type"
|
||||
t.integer "user_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.boolean "status", :default => true
|
||||
t.integer "project_id"
|
||||
t.decimal "subscribeable_id", :precision => 50, :scale => 0
|
||||
|
@ -425,18 +468,21 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
|
||||
create_table "users", :force => true do |t|
|
||||
t.string "name"
|
||||
t.string "email", :default => "", :null => false
|
||||
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
||||
t.string "email", :default => "", :null => false
|
||||
t.string "encrypted_password", :default => "", :null => false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.datetime "remember_created_at"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.text "ssh_key"
|
||||
t.string "uname"
|
||||
t.string "role"
|
||||
t.string "language", :default => "en"
|
||||
t.integer "own_projects_count", :default => 0, :null => false
|
||||
t.string "language", :default => "en"
|
||||
t.integer "own_projects_count", :default => 0, :null => false
|
||||
t.string "confirmation_token"
|
||||
t.datetime "confirmed_at"
|
||||
t.datetime "confirmation_sent_at"
|
||||
t.text "professional_experience"
|
||||
t.string "site"
|
||||
t.string "company"
|
||||
|
@ -445,14 +491,11 @@ ActiveRecord::Schema.define(:version => 20121106113338) do
|
|||
t.string "avatar_content_type"
|
||||
t.integer "avatar_file_size"
|
||||
t.datetime "avatar_updated_at"
|
||||
t.integer "failed_attempts", :default => 0
|
||||
t.integer "failed_attempts", :default => 0
|
||||
t.string "unlock_token"
|
||||
t.datetime "locked_at"
|
||||
t.string "confirmation_token"
|
||||
t.datetime "confirmed_at"
|
||||
t.datetime "confirmation_sent_at"
|
||||
t.string "authentication_token"
|
||||
t.integer "build_priority", :default => 50
|
||||
t.integer "build_priority", :default => 50
|
||||
end
|
||||
|
||||
add_index "users", ["authentication_token"], :name => "index_users_on_authentication_token"
|
||||
|
|
|
@ -5,7 +5,7 @@ module Modules
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
|
||||
|
||||
validate lambda {
|
||||
if project && (commit_hash.blank? || project.repo.commit(commit_hash).blank?)
|
||||
errors.add :commit_hash, I18n.t('flash.build_list.wrong_commit_hash', :commit_hash => commit_hash)
|
||||
|
@ -13,6 +13,7 @@ module Modules
|
|||
}
|
||||
|
||||
before_validation :set_commit_and_version
|
||||
before_create :set_last_published_commit
|
||||
end
|
||||
|
||||
protected
|
||||
|
@ -25,6 +26,10 @@ module Modules
|
|||
self.project_version = commit_hash
|
||||
end
|
||||
end
|
||||
|
||||
def set_last_published_commit
|
||||
self.last_published_commit_hash = self.last_published.try :commit_hash
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue