Class: Shh::Command::DiffEntry

Inherits:
Object
  • Object
show all
Includes:
HistoricEntryCommand
Defined in:
lib/shh/command/diff_entry.rb

Instance Method Summary collapse

Methods included from HistoricEntryCommand

#completion, #initialize, #usage

Instance Method Details

#execute(text = nil) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/shh/command/diff_entry.rb', line 11

def execute text=nil
  with_current_and_historic_entry(text) do |current, changeset, historic|
    diff = current.diff(historic)
    if diff.empty?
      puts "no changes"
    else
      added = current.keys - historic.keys
      removed = historic.keys-current.keys
      modified = diff.keys - (added + removed)
      puts "added #{added.join(',')}" unless added.empty?
      puts "removed #{removed.join(',')}" unless removed.empty?
      puts "modified #{modified.join(',')}" unless modified.empty?
    end
  end
end

#helpObject



7
8
9
# File 'lib/shh/command/diff_entry.rb', line 7

def help
  "Displays changes made since the specified revision of the entry\nRevision is a number representing the number of changesets to go back in history (ie. 0 is the most recently committed version)"
end