diff options
author | scott Chacon <schacon@agadorsparticus.corp.reactrix.com> | 2007-11-09 13:11:22 -0800 |
---|---|---|
committer | scott Chacon <schacon@agadorsparticus.corp.reactrix.com> | 2007-11-09 13:11:22 -0800 |
commit | 9d59d2965184964ab6662282ef5f9ceac2c58552 (patch) | |
tree | f8dd8bf4004eb9403f9ffe2b5c5c708ef877895a /lib/git/branches.rb | |
parent | ab20a674e50268b6c541949c746d77b16a26d15c (diff) | |
download | third_party-ruby-git-9d59d2965184964ab6662282ef5f9ceac2c58552.tar.gz third_party-ruby-git-9d59d2965184964ab6662282ef5f9ceac2c58552.tar.xz third_party-ruby-git-9d59d2965184964ab6662282ef5f9ceac2c58552.zip |
added branches, more log stuff, better tests, changed the log api a bit
added tests for Git::Lib, started Git::Diff development
Diffstat (limited to 'lib/git/branches.rb')
-rw-r--r-- | lib/git/branches.rb | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/git/branches.rb b/lib/git/branches.rb index d664d59..81abe22 100644 --- a/lib/git/branches.rb +++ b/lib/git/branches.rb @@ -8,8 +8,36 @@ module Git @branches = nil def initialize(base) + @branches = {} + @base = base - @branches = @base.lib.branches_all + @base.lib.branches_all.each do |b| + @branches[b.full] = b + end + end + + def local + self.select { |b| !b.remote } + end + + def remote + self.select { |b| b.remote } + end + + # array like methods + + def size + @branches.size + end + + def each + @branches.each do |k, b| + yield b + end + end + + def [](symbol) + @branches[symbol.to_s] end end |