Sha256: a40d44f0b2deb045a048c975b21ede3e5ce334294bbce3f09134507e9bc220a0

Contents?: true

Size: 725 Bytes

Versions: 15

Compression:

Stored size: 725 Bytes

Contents

require_relative 'log_parser'

module Gitlab
  module Git
    class GitStats
      attr_accessor :repo, :ref, :timeout

      def initialize(repo, ref, timeout = 30)
        @repo, @ref, @timeout = repo, ref, timeout
      end

      def log
        log = nil
        Grit::Git.with_timeout(timeout) do
          # Limit log to 6k commits to avoid timeout for huge projects
          args = [ref, '-6000', '--format=%aN%x0a%aE%x0a%cd', '--date=short', '--shortstat', '--no-merges', '--diff-filter=ACDM']
          log = repo.git.run(nil, 'log', nil, {}, args)
        end

        log
      rescue Grit::Git::GitTimeout
        nil
      end

      def parsed_log
        LogParser.parse_log(log)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
gitlab_git-5.7.1 lib/gitlab_git/git_stats.rb
gitlab_git-5.7.0 lib/gitlab_git/git_stats.rb
gitlab_git-5.6.0 lib/gitlab_git/git_stats.rb
gitlab_git-5.5.0 lib/gitlab_git/git_stats.rb
gitlab_git-5.4.0 lib/gitlab_git/git_stats.rb
gitlab_git-5.3.0 lib/gitlab_git/git_stats.rb
gitlab_git-5.2.0 lib/gitlab_git/git_stats.rb
gitlab_git-5.1.0 lib/gitlab_git/git_stats.rb
gitlab_git-5.0.0 lib/gitlab_git/git_stats.rb
gitlab_git-4.1.0 lib/gitlab_git/git_stats.rb
gitlab_git-4.0.0 lib/gitlab_git/git_stats.rb
gitlab_git-4.0.0.pre lib/gitlab_git/git_stats.rb
gitlab_git-3.1.0 lib/gitlab_git/git_stats.rb
gitlab_git-3.0.1 lib/gitlab_git/git_stats.rb
gitlab_git-3.0.0 lib/gitlab_git/git_stats.rb