Class: RevList
Constant Summary collapse
- RANGE =
/^(.*)\.\.(.*)$/
- EXCLUDE =
/^\^(.+)$/
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(repo, revs, options = {}) ⇒ RevList
constructor
A new instance of RevList.
- #tree_diff(old_oid, new_oid) ⇒ Object
Constructor Details
#initialize(repo, revs, options = {}) ⇒ RevList
Returns a new instance of RevList.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rev_list.rb', line 13 def initialize(repo, revs, = {}) @repo = repo @commits = {} @flags = Hash.new { |hash, oid| hash[oid] = Set.new } @queue = [] @limited = false @prune = [] @diffs = {} @output = [] @pending = [] @paths = {} @objects = .fetch(:objects, false) @missing = .fetch(:missing, false) @walk = .fetch(:walk, true) include_refs(repo.refs.list_all_refs) if [:all] include_refs(repo.refs.list_branches) if [:branches] include_refs(repo.refs.list_remotes) if [:remotes] revs.each { |rev| handle_revision(rev) } handle_revision(Revision::HEAD) if @queue.empty? @filter = PathFilter.build(@prune) end |
Instance Method Details
#each ⇒ Object
39 40 41 42 43 44 |
# File 'lib/rev_list.rb', line 39 def each limit_list if @limited mark_edges_uninteresting if @objects traverse_commits { |commit| yield commit } traverse_pending { |object| yield object, @paths[object.oid] } end |
#tree_diff(old_oid, new_oid) ⇒ Object
46 47 48 49 |
# File 'lib/rev_list.rb', line 46 def tree_diff(old_oid, new_oid) key = [old_oid, new_oid] @diffs[key] ||= @repo.database.tree_diff(old_oid, new_oid, @filter) end |