<commit_before># ProjectTransferService class
#
# Used for transfer project to another namespace
#
class ProjectTransferService
  include Gitlab::ShellAdapter

  attr_accessor :project

  def transfer(project, new_namespace)
    Project.transaction do
      old_path = project.path_with_namespace
      new_path = File.join(new_namespace.try(:path) || '', project.path)

      if Project.where(path: project.path, namespace_id: new_namespace.try(:id)).present?
        raise TransferError.new("Project with same path in target namespace already exists")
      end

      project.namespace = new_namespace
      project.save!

      unless gitlab_shell.mv_repository(old_path, new_path)
        raise TransferError.new('Cannot move project')
      end

      true
    end
  rescue => ex
    raise Project::TransferError.new(ex.message)
  end
end

<commit_msg>transfer also wiki repository when transfer a project<commit_after># ProjectTransferService class
#
# Used for transfer project to another namespace
#
class ProjectTransferService
  include Gitlab::ShellAdapter

  class TransferError < StandardError; end

  attr_accessor :project

  def transfer(project, new_namespace)
    Project.transaction do
      old_path = project.path_with_namespace
      new_path = File.join(new_namespace.try(:path) || '', project.path)

      if Project.where(path: project.path, namespace_id: new_namespace.try(:id)).present?
        raise TransferError.new("Project with same path in target namespace already exists")
      end

      project.namespace = new_namespace
      project.save!

      # Move main repository
      unless gitlab_shell.mv_repository(old_path, new_path)
        raise TransferError.new('Cannot move project')
      end

      # Move wiki repo also if present
      if project.wikis.any?
        gitlab_shell.mv_repository("#{old_path}.wiki", "#{new_path}.wiki")
      end

      true
    end
  end
end


{'fraction_non_alphanumeric': 0.07977059436913451, 'fraction_numerical': 0.0, 'mean_word_length': 3.4941451990632317, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2125689', 'n_tokens_mistral': 531, 'n_tokens_neox': 514, 'n_words': 143}