Class: Archaeologist::RepoWalker
- Inherits:
-
Object
- Object
- Archaeologist::RepoWalker
- Defined in:
- lib/archaeologist/repowalker.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(repo, email) ⇒ RepoWalker
constructor
A new instance of RepoWalker.
Constructor Details
#initialize(repo, email) ⇒ RepoWalker
Returns a new instance of RepoWalker.
69 70 71 72 |
# File 'lib/archaeologist/repowalker.rb', line 69 def initialize(repo, email) @repo = Rugged::Repository.new(repo) @email = email end |
Instance Method Details
#each ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/archaeologist/repowalker.rb', line 74 def each() walker = Rugged::Walker.new(@repo) already_walked = [] @repo.branches.each { |br| cur_l = nil cur_oid = nil walker.sorting(Rugged::SORT_TOPO | Rugged::SORT_REVERSE) walker.push(br.target_id) walker.each { |c| cur_l = c.parents.empty? ? Linguist::Repository.new(@repo, c.oid) : Linguist::Repository.incremental( @repo, c.oid, cur_oid, cur_l.cache ) cur_oid = c.oid if (c.[:email] == @email || !@email&.size) && !already_walked.include?(c.oid) already_walked << c.oid yield(c, cur_l) end } } walker.reset() end |