Class: PVN::Seek::Path
- Inherits:
-
Object
- Object
- PVN::Seek::Path
- Includes:
- Logue::Loggable
- Defined in:
- lib/pvn/seek/path.rb
Instance Method Summary collapse
- #get_entries(revision) ⇒ Object
- #get_seek_class(type) ⇒ Object
-
#initialize(path) ⇒ Path
constructor
A new instance of Path.
- #seek(type, pattern, revision, use_color) ⇒ Object
- #show_no_match(type, entries) ⇒ Object
- #to_revision_arg(revision) ⇒ Object
Constructor Details
#initialize(path) ⇒ Path
Returns a new instance of Path.
12 13 14 |
# File 'lib/pvn/seek/path.rb', line 12 def initialize path @path = path end |
Instance Method Details
#get_entries(revision) ⇒ Object
25 26 27 28 29 |
# File 'lib/pvn/seek/path.rb', line 25 def get_entries revision args = { revision: revision, limit: nil, files: nil, use_cache: nil, path: @path } exec = SVNx::LogExec.new args exec.entries.to_a end |
#get_seek_class(type) ⇒ Object
38 39 40 |
# File 'lib/pvn/seek/path.rb', line 38 def get_seek_class type type == :added ? SeekerAdded : SeekerRemoved end |
#seek(type, pattern, revision, use_color) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/pvn/seek/path.rb', line 42 def seek type, pattern, revision, use_color entries = get_entries revision seekcls = get_seek_class type @seeker = seekcls.new @path, pattern, revision, entries if match = @seeker.seek match.show @path, use_color else show_no_match type, entries end end |
#show_no_match(type, entries) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/pvn/seek/path.rb', line 31 def show_no_match type, entries msg = type == :added ? "not found" : "not removed" fromrev = entries[-1].revision torev = entries[0].revision $io.puts "#{msg} in revisions: #{fromrev} .. #{torev}" end |
#to_revision_arg(revision) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/pvn/seek/path.rb', line 16 def to_revision_arg revision return unless revision if revision.size == 1 [ revision[0], 'HEAD' ].join(':') else revision.join ':' end end |