Class: PVN::Log::Command
- Inherits:
-
Command::Command
- Object
- Command::Command
- PVN::Log::Command
- Defined in:
- lib/pvn/log/command.rb
Constant Summary collapse
- DEFAULT_LIMIT =
15
Instance Method Summary collapse
Methods inherited from Command::Command
description, example, getdoc, #initialize, matches_subcommand?, optscls, optset, #show_help, subcommands, summary, #to_doc, usage
Constructor Details
This class inherits a constructor from PVN::Command::Command
Instance Method Details
#init(options) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/pvn/log/command.rb', line 35 def init paths = .paths paths = %w{ . } if paths.empty? info "paths: #{paths}" allentries = Array.new args = { revision: .revision, limit: .limit, files: .files, use_cache: false } if .user limit = args[:limit] args[:limit] = nil args[:user] = .user paths.each do |path| args[:path] = path exec = SVNx::LogExec.new args # SVNx::Entries => Array entries: userentries = Hash.new exec.entries.entries.each do |entry| break if userentries.size >= limit if entry. == args[:user] userentries[userentries.size] = entry end end raise "ERROR: no matching log entries for '#{args[:user]}'" if userentries.empty? allentries.concat userentries.values end else paths.each do |path| args[:path] = path exec = SVNx::LogExec.new args # SVNx::Entries => Array entries: allentries.concat exec.entries.entries end end # we can show relative revisions for a single path, without filtering by # user, or by limit or revision. show_relative = !.user && paths.size == 1 && !.revision # this should be refined to options.revision.head? from_head = show_relative from_tail = show_relative && !.limit ef = PVN::Log::EntriesFormatter.new .color, allentries, from_head, from_tail $io.puts ef.format end |