Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-03 09:08:50 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-03 09:08:50 +0300
commit139f9c7dc18372bc4cdfaab5f887eae5e3547fa5 (patch)
tree98daa01f7ce13284404b05903326856eb7c35a9c /lib
parent2c91139c78ce382738c2c5b615cbfba0dd3fed66 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/ci/model.rb15
-rw-r--r--lib/gitlab/database/multi_threaded_migration.rb52
-rw-r--r--lib/gitlab/diff/file_collection/base.rb6
3 files changed, 6 insertions, 67 deletions
diff --git a/lib/gitlab/ci/model.rb b/lib/gitlab/ci/model.rb
deleted file mode 100644
index 1625cb841b6..00000000000
--- a/lib/gitlab/ci/model.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module Ci
- module Model
- def table_name_prefix
- "ci_"
- end
-
- def model_name
- @model_name ||= ActiveModel::Name.new(self, nil, self.name.demodulize)
- end
- end
- end
-end
diff --git a/lib/gitlab/database/multi_threaded_migration.rb b/lib/gitlab/database/multi_threaded_migration.rb
deleted file mode 100644
index 9381aaf79b9..00000000000
--- a/lib/gitlab/database/multi_threaded_migration.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-# frozen_string_literal: true
-
-module Gitlab
- module Database
- module MultiThreadedMigration
- MULTI_THREAD_AR_CONNECTION = :thread_local_ar_connection
-
- # This overwrites the default connection method so that every thread can
- # use a thread-local connection, while still supporting all of Rails'
- # migration methods.
- def connection
- Thread.current[MULTI_THREAD_AR_CONNECTION] ||
- ActiveRecord::Base.connection
- end
-
- # Starts a thread-pool for N threads, along with N threads each using a
- # single connection. The provided block is yielded from inside each
- # thread.
- #
- # Example:
- #
- # with_multiple_threads(4) do
- # execute('SELECT ...')
- # end
- #
- # thread_count - The number of threads to start.
- #
- # join - When set to true this method will join the threads, blocking the
- # caller until all threads have finished running.
- #
- # Returns an Array containing the started threads.
- def with_multiple_threads(thread_count, join: true)
- pool = Gitlab::Database.main.create_connection_pool(thread_count)
-
- threads = Array.new(thread_count) do
- Thread.new do
- pool.with_connection do |connection|
- Thread.current[MULTI_THREAD_AR_CONNECTION] = connection
- yield
- ensure
- Thread.current[MULTI_THREAD_AR_CONNECTION] = nil
- end
- end
- end
-
- threads.each(&:join) if join
-
- threads
- end
- end
- end
-end
diff --git a/lib/gitlab/diff/file_collection/base.rb b/lib/gitlab/diff/file_collection/base.rb
index 6d04c4874c7..f73e060be7f 100644
--- a/lib/gitlab/diff/file_collection/base.rb
+++ b/lib/gitlab/diff/file_collection/base.rb
@@ -43,10 +43,16 @@ module Gitlab
end
end
+ # This is either the new path, otherwise the old path for the diff_file
def diff_file_paths
diff_files.map(&:file_path)
end
+ # This is both the new and old paths for the diff_file
+ def diff_paths
+ diff_files.map(&:paths).flatten.uniq
+ end
+
def pagination_data
@pagination_data || empty_pagination_data
end