Skip to content
Snippets Groups Projects
Commit e7c930a5 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Add imported boolean to project. Prevent shell from creating repo after it was imported

parent da98cebc
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -51,6 +51,7 @@ module Projects
if shell.import_repository(@project.path_with_namespace, @project.import_url)
# We should create satellite for imported repo
@project.satellite.create unless @project.satellite.exists?
@project.imported = true
true
else
@project.errors.add(:import_url, 'cannot clone repo')
Loading
Loading
Loading
Loading
@@ -142,7 +142,7 @@ module ApplicationHelper
end
 
def user_color_scheme_class
COLOR_SCHEMES[current_user.try(:color_scheme_id)]
COLOR_SCHEMES[current_user.try(:color_scheme_id)] if defined?(current_user)
end
 
# Define whenever show last push event
Loading
Loading
Loading
Loading
@@ -413,6 +413,10 @@ class Project < ActiveRecord::Base
!(forked_project_link.nil? || forked_project_link.forked_from_project.nil?)
end
 
def imported?
imported
end
def rename_repo
old_path_with_namespace = File.join(namespace_dir, path_was)
new_path_with_namespace = File.join(namespace_dir, path)
Loading
Loading
class ProjectObserver < BaseObserver
def after_create(project)
unless project.forked?
GitlabShellWorker.perform_async(
:add_repository,
project.path_with_namespace
)
log_info("#{project.owner.name} created a new project \"#{project.name_with_namespace}\"")
end
return true if project.forked? || project.imported?
GitlabShellWorker.perform_async(
:add_repository,
project.path_with_namespace
)
log_info("#{project.owner.name} created a new project \"#{project.name_with_namespace}\"")
end
 
def after_update(project)
Loading
Loading
class AddImprotedToProject < ActiveRecord::Migration
def change
add_column :projects, :imported, :boolean, default: false, null: false
end
end
Loading
Loading
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
 
ActiveRecord::Schema.define(:version => 20130613173246) do
ActiveRecord::Schema.define(:version => 20130614132337) do
 
create_table "deploy_keys_projects", :force => true do |t|
t.integer "deploy_key_id", :null => false
Loading
Loading
@@ -172,6 +172,7 @@ ActiveRecord::Schema.define(:version => 20130613173246) do
t.string "issues_tracker_id"
t.boolean "snippets_enabled", :default => true, :null => false
t.datetime "last_activity_at"
t.boolean "imported", :default => false, :null => false
end
 
add_index "projects", ["creator_id"], :name => "index_projects_on_owner_id"
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment