Permalink
Browse files

update to use latest rugged API, closes #24

  • Loading branch information...
1 parent e248190 commit dd491dd8d9de487dd12acfd99e07a6cc7dccb226 @igrigorik committed Jul 6, 2014
Showing with 3 additions and 10 deletions.
  1. +1 −5 bugspots.gemspec
  2. +2 −5 lib/bugspots/scanner.rb
View
6 bugspots.gemspec
@@ -18,10 +18,6 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
- s.add_dependency "rugged"
+ s.add_dependency "rugged", ">= 0.21.0"
s.add_dependency "rainbow"
-
- # specify any dependencies here; for example:
- # s.add_development_dependency "rspec"
- # s.add_runtime_dependency "rest-client"
end
View
7 lib/bugspots/scanner.rb
@@ -9,16 +9,13 @@ def self.scan(repo, branch = "master", depth = 500, regex = nil)
fixes = []
repo = Rugged::Repository.new(repo)
- unless Rugged::Branch.each_name(repo).sort.find { |b| b == branch }
+ unless repo.branches.each_name(:local).sort.find { |b| b == branch }
raise ArgumentError, "no such branch in the repo: #{branch}"
end
walker = Rugged::Walker.new(repo)
walker.sorting(Rugged::SORT_TOPO | Rugged::SORT_REVERSE)
-
- tip = Rugged::Branch.lookup(repo, branch).tip.oid
- walker.push(tip)
-
+ walker.push(repo.branches[branch].target)
walker.each do |commit|
if commit.message =~ regex
files = commit.diff(commit.parents.first).deltas.collect do |d|

0 comments on commit dd491dd

Please sign in to comment.