repo.or.cz
/
rubygit.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
added branches, more log stuff, better tests, changed the log api a bit
[rubygit.git]
/
lib
/
git
/
diff.rb
blob
3686edb22d5eecd414f2c4d60e1af94d235f1061
1
module Git
2
3
# object that holds the last X commits on given branch
4
class Diff
5
include Enumerable
6
7
@base = nil
8
@from = nil
9
@to = nil
10
11
@full_diff = nil
12
13
def initialize(base, from = nil, to = nil)
14
dirty_log
15
@base = base
16
@from = from
17
@to = to
18
end
19
20
def
21
# enumerable methods
22
23
def each
24
cache_diff
25
@full_diff.each do |file|
26
yield file
27
end
28
end
29
30
private
31
32
def cache_diff
33
if !@full_diff
34
@full_diff = @base.lib.diff_files(@from, @to)
35
end
36
end
37
end