Commit 19e40ff2 authored by Nick Thomas's avatar Nick Thomas

Resolve conflicts in Project model

parent 104132d7
...@@ -344,13 +344,10 @@ class Project < ActiveRecord::Base ...@@ -344,13 +344,10 @@ class Project < ActiveRecord::Base
event :import_fail do event :import_fail do
transition [:scheduled, :started] => :failed transition [:scheduled, :started] => :failed
<<<<<<< HEAD
=======
end end
event :import_retry do event :import_retry do
transition failed: :started transition failed: :started
>>>>>>> ce/master
end end
state :scheduled state :scheduled
...@@ -358,18 +355,14 @@ class Project < ActiveRecord::Base ...@@ -358,18 +355,14 @@ class Project < ActiveRecord::Base
state :finished state :finished
state :failed state :failed
<<<<<<< HEAD
before_transition [:none, :finished, :failed] => :scheduled do |project, _| before_transition [:none, :finished, :failed] => :scheduled do |project, _|
project.mirror_data&.last_update_scheduled_at = Time.now project.mirror_data&.last_update_scheduled_at = Time.now
end end
=======
>>>>>>> ce/master
after_transition [:none, :finished, :failed] => :scheduled do |project, _| after_transition [:none, :finished, :failed] => :scheduled do |project, _|
project.run_after_commit { add_import_job } project.run_after_commit { add_import_job }
end end
<<<<<<< HEAD
before_transition scheduled: :started do |project, _| before_transition scheduled: :started do |project, _|
project.mirror_data&.last_update_started_at = Time.now project.mirror_data&.last_update_started_at = Time.now
end end
...@@ -417,9 +410,8 @@ class Project < ActiveRecord::Base ...@@ -417,9 +410,8 @@ class Project < ActiveRecord::Base
after_transition [:finished, :failed] => [:scheduled, :started] do |project, _| after_transition [:finished, :failed] => [:scheduled, :started] do |project, _|
Gitlab::Mirror.increment_capacity(project.id) if project.mirror? Gitlab::Mirror.increment_capacity(project.id) if project.mirror?
end end
=======
after_transition started: :finished, do: :reset_cache_and_import_attrs after_transition started: :finished, do: :reset_cache_and_import_attrs
>>>>>>> ce/master
end end
class << self class << self
......
...@@ -51,10 +51,7 @@ describe Project, models: true do ...@@ -51,10 +51,7 @@ describe Project, models: true do
it { is_expected.to have_one(:project_feature).dependent(:destroy) } it { is_expected.to have_one(:project_feature).dependent(:destroy) }
it { is_expected.to have_one(:statistics).class_name('ProjectStatistics').dependent(:delete) } it { is_expected.to have_one(:statistics).class_name('ProjectStatistics').dependent(:delete) }
it { is_expected.to have_one(:import_data).class_name('ProjectImportData').dependent(:delete) } it { is_expected.to have_one(:import_data).class_name('ProjectImportData').dependent(:delete) }
<<<<<<< HEAD
it { is_expected.to have_one(:mirror_data).class_name('ProjectMirrorData').dependent(:delete) } it { is_expected.to have_one(:mirror_data).class_name('ProjectMirrorData').dependent(:delete) }
=======
>>>>>>> ce/master
it { is_expected.to have_one(:last_event).class_name('Event') } it { is_expected.to have_one(:last_event).class_name('Event') }
it { is_expected.to have_one(:forked_from_project).through(:forked_project_link) } it { is_expected.to have_one(:forked_from_project).through(:forked_project_link) }
it { is_expected.to have_many(:commit_statuses) } it { is_expected.to have_many(:commit_statuses) }
...@@ -1923,15 +1920,12 @@ describe Project, models: true do ...@@ -1923,15 +1920,12 @@ describe Project, models: true do
it 'schedules a RepositoryImportWorker job' do it 'schedules a RepositoryImportWorker job' do
project = create(:empty_project, import_url: generate(:url)) project = create(:empty_project, import_url: generate(:url))
expect(RepositoryImportWorker).to receive(:perform_async).with(project.id)
expect(RepositoryImportWorker).to receive(:perform_async).with(project.id) expect(RepositoryImportWorker).to receive(:perform_async).with(project.id)
project.add_import_job project.add_import_job
end end
end end
end end
end
describe '#gitlab_project_import?' do describe '#gitlab_project_import?' do
subject(:project) { build(:empty_project, import_type: 'gitlab_project') } subject(:project) { build(:empty_project, import_type: 'gitlab_project') }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment