diff options
author | scott Chacon <schacon@agadorsparticus.corp.reactrix.com> | 2007-11-08 11:22:46 -0800 |
---|---|---|
committer | scott Chacon <schacon@agadorsparticus.corp.reactrix.com> | 2007-11-08 11:22:46 -0800 |
commit | b18bca3b853dee6a7bc86f09921aa3b1ee3f3d7b (patch) | |
tree | 718f1b6451f5a9dd9b8cb844fa3d3e9f32400d50 /lib/git/log.rb | |
parent | 169381bbce998807c119f291d69b8ae1d8fb5785 (diff) | |
download | third_party-ruby-git-b18bca3b853dee6a7bc86f09921aa3b1ee3f3d7b.tar.gz third_party-ruby-git-b18bca3b853dee6a7bc86f09921aa3b1ee3f3d7b.tar.xz third_party-ruby-git-b18bca3b853dee6a7bc86f09921aa3b1ee3f3d7b.zip |
added log functions
Diffstat (limited to 'lib/git/log.rb')
-rw-r--r-- | lib/git/log.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/git/log.rb b/lib/git/log.rb new file mode 100644 index 0000000..fab605e --- /dev/null +++ b/lib/git/log.rb @@ -0,0 +1,35 @@ +module Git + + # object that holds the last X commits on given branch + class Log + include Enumerable + + @base = nil + @commits = nil + + def initialize(base, count = 30) + @base = base + @commits = @base.lib.log_shas(count) + end + + def size + @commits.size + end + + def each + @commits.each do |c| + yield c + end + end + + def first + @commits.first + end + + def to_s + self.map { |c| c.sha }.join("\n") + end + + end + +end
\ No newline at end of file |