Module: Metior::Git

Includes:
VCS
Defined in:
lib/metior/git.rb,
lib/metior/git/actor.rb,
lib/metior/git/commit.rb,
lib/metior/git/repository.rb

Overview

The Metior implementation for Git

Author:

  • Sebastian Staudt

Defined Under Namespace

Classes: Actor, Commit, Repository

Constant Summary collapse

NAME =

Git will be registered as :git

:git
DEFAULT_BRANCH =

Git's default branch is master

'master'

Instance Method Summary collapse

Methods included from VCS

included, #support!, #supports?, #vcs

Instance Method Details

#load_file_statsObject

Loads the file stats for this commit from the repository



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/metior/git/commit.rb', line 40

def load_file_stats
  @added_files    = []
  @modified_files = []
  @deleted_files  = []
  @repo.raw_commit(@id).diffs.each do |diff|
    if diff.new_file
      @added_files    << diff.b_path
    elsif diff.deleted_file
      @deleted_files  << diff.b_path
    elsif diff.renamed_file
      @added_files    << diff.b_path
      @deleted_files  << diff.a_path
    else
      @modified_files << diff.b_path
    end
  end
end

#load_line_statsObject

Loads the line stats for this commit from the repository



61
62
63
64
65
# File 'lib/metior/git/commit.rb', line 61

def load_line_stats
  commit = @repo.raw_commit @id
  @additions = commit.stats.additions
  @deletions = commit.stats.deletions
end