Class: Dolt::RepoActions

Inherits:
Object
  • Object
show all
Defined in:
lib/dolt/repo_actions.rb

Instance Method Summary collapse

Constructor Details

#initialize(repo_resolver) ⇒ RepoActions

Returns a new instance of RepoActions.



23
24
25
# File 'lib/dolt/repo_actions.rb', line 23

def initialize(repo_resolver)
  @repo_resolver = repo_resolver
end

Instance Method Details

#blame(repo, ref, path, &block) ⇒ Object



35
36
37
# File 'lib/dolt/repo_actions.rb', line 35

def blame(repo, ref, path, &block)
  repo_action(repo, ref, path, :blame, :blame, ref, path, &block)
end

#blob(repo, ref, path, &block) ⇒ Object



27
28
29
# File 'lib/dolt/repo_actions.rb', line 27

def blob(repo, ref, path, &block)
  repo_action(repo, ref, path, :blob, :rev_parse, "#{ref}:#{path}", &block)
end

#history(repo, ref, path, count, &block) ⇒ Object



39
40
41
# File 'lib/dolt/repo_actions.rb', line 39

def history(repo, ref, path, count, &block)
  repo_action(repo, ref, path, :commits, :log, ref, path, count, &block)
end

#refs(repo, &block) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/dolt/repo_actions.rb', line 43

def refs(repo, &block)
  repository = repo_resolver.resolve(repo)
  d = repository.refs
  d.callback do |refs|
    names = refs.map(&:name)
    block.call(nil, {
                 :repository => repo,
                 :tags => stripped_ref_names(names, :tags),
                 :heads => stripped_ref_names(names, :heads)
               })
  end
  d.errback { |err| block.call(err, nil) }
end

#repositoriesObject



61
62
63
# File 'lib/dolt/repo_actions.rb', line 61

def repositories
  repo_resolver.all
end

#tree(repo, ref, path, &block) ⇒ Object



31
32
33
# File 'lib/dolt/repo_actions.rb', line 31

def tree(repo, ref, path, &block)
  repo_action(repo, ref, path, :tree, :rev_parse, "#{ref}:#{path}", &block)
end

#tree_history(repo, ref, path, count, &block) ⇒ Object



57
58
59
# File 'lib/dolt/repo_actions.rb', line 57

def tree_history(repo, ref, path, count, &block)
  repo_action(repo, ref, path, :tree, :tree_history, ref, path, count, &block)
end