Module: DTK::Common::GritAdapter::FileAccess::DiffMixin
- Included in:
- DTK::Common::GritAdapter::FileAccess
- Defined in:
- lib/grit_adapter/file_access/diff.rb
Defined Under Namespace
Instance Method Summary collapse
Instance Method Details
#diff(*args) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/grit_adapter/file_access/diff.rb', line 20 def diff(*args) diff_comamnd_args = case args.size when 1 then [@branch,args[0]] when 2 then args else raise Error.new("diff must have 1 or 2 arguments") end grit_diffs = @grit_repo.diff(*diff_comamnd_args) array_diff_hashes = grit_diffs.map do |diff| Diff::Attributes.inject(Hash.new) do |h,a| val = diff.send(a) val ? h.merge(a => val) : h end end Diffs.new(array_diff_hashes) end |