Sha256: d1176fba5ba75b410c62e02341a55c48036e65d233b160ed96a0fa9316125095

Contents?: true

Size: 717 Bytes

Versions: 9

Compression:

Stored size: 717 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.native(:log, {}, args)
        end

        log
      rescue Grit::Git::GitTimeout
        nil
      end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gitlab_git-6.2.2 lib/gitlab_git/git_stats.rb
gitlab_git-6.3.0 lib/gitlab_git/git_stats.rb
gitlab_git-6.2.1 lib/gitlab_git/git_stats.rb
gitlab_git-6.2.0 lib/gitlab_git/git_stats.rb
gitlab_git-6.1.0 lib/gitlab_git/git_stats.rb
gitlab_git-6.0.1 lib/gitlab_git/git_stats.rb
gitlab_git-6.0.0 lib/gitlab_git/git_stats.rb
gitlab_git-5.9.0 lib/gitlab_git/git_stats.rb
gitlab_git-5.8.0 lib/gitlab_git/git_stats.rb