Class: HgBlameGame

Inherits:
Object
  • Object
show all
Defined in:
lib/hg-blame-game/hg_blame_game.rb

Instance Method Summary collapse

Constructor Details

#initialize(path_to_file, opts = {}) ⇒ HgBlameGame

Returns a new instance of HgBlameGame.



2
3
4
5
# File 'lib/hg-blame-game/hg_blame_game.rb', line 2

def initialize(path_to_file, opts={})
  @path_to_file = path_to_file
  @changeset_id = !opts[:changeset_id].nil? ? opts[:changeset_id] : 'tip'
end

Instance Method Details

#runObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/hg-blame-game/hg_blame_game.rb', line 7

def run
  loop do
    p_flush("\n")

    changeset_id_to_show = show_hg_blame_and_prompt_for_changeset_id

    p_flush("\n")

    files_changed = sys("hg status --change #{changeset_id_to_show}").split("\n").map { |g| g.split(' ').last }

    @path_to_file = prompt_for_file(files_changed, changeset_id_to_show)
    @changeset_id = "#{changeset_id_to_show}^"
  end
end