<commit_before>module Dapp
  # Project
  class Project
    # Command
    module Command
      module Stages
        # CleanupRepo
        module CleanupRepo
          def stages_cleanup_repo(repo)
            lock_repo(repo) do
              registry = registry(repo)
              repo_applications, repo_stages = repo_images(registry)
              proper_repo_cache(registry, repo_stages) if proper_cache_version?
              log_step_with_indent(repo) do
                repo_applications.each { |image_tag, image_id| clear_repo_stages(registry, repo_stages, image_tag, image_id) }
                repo_stages.keys.each { |image_tag| delete_repo_image(registry, image_tag) }
              end
            end
          end

          protected

          def clear_repo_stages(registry, repo_stages, image_tag, image_id)
            repo_image_dapp_artifacts_labels(registry, image_tag).each do |iid|
              itag = find_image_tag_by_id(repo_stages, iid)
              clear_repo_stages(registry, repo_stages, itag, iid) unless itag.nil?
            end

            itag = image_tag
            iid = image_id
            loop do
              repo_stages.delete_if { |_, siid| siid == iid }
              break if itag.nil? || (iid = registry.image_parent_id(itag)).empty?<commit_msg>modified cleanup_repo: ignored stages with apps ids (v2)<commit_after>module Dapp
  # Project
  class Project
    # Command
    module Command
      module Stages
        # CleanupRepo
        module CleanupRepo
          def stages_cleanup_repo(repo)
            lock_repo(repo) do
              registry = registry(repo)
              repo_applications, repo_stages = repo_images(registry)
              repo_stages.delete_if { |_, siid| repo_applications.values.include?(siid) } # ignoring stages with apps ids (v2)
              proper_repo_cache(registry, repo_stages) if proper_cache_version?
              log_step_with_indent(repo) do
                repo_applications.each { |image_tag, image_id| clear_repo_stages(registry, repo_stages, image_tag, image_id) }
                repo_stages.keys.each { |image_tag| delete_repo_image(registry, image_tag) }
              end
            end
          end

          protected

          def clear_repo_stages(registry, repo_stages, image_tag, image_id)
            repo_image_dapp_artifacts_labels(registry, image_tag).each do |iid|
              itag = find_image_tag_by_id(repo_stages, iid)
              clear_repo_stages(registry, repo_stages, itag, iid) unless itag.nil?
            end

            itag = image_tag
            iid = image_id
            loop do
              repo_stages.delete_if { |_, siid| siid == iid }
              break if itag.nil? || (iid = registry.image_parent_id(itag)).empty?
{'fraction_non_alphanumeric': 0.0690527838033261, 'fraction_numerical': 0.0007230657989877079, 'mean_word_length': 2.13718820861678, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2132914', 'n_tokens_mistral': 825, 'n_tokens_neox': 818, 'n_words': 169}