Class: PVN::Log::Command
Constant Summary
collapse
- DEFAULT_LIMIT =
15
Instance Method Summary
collapse
description, example, getdoc, #initialize, matches_subcommand?, options, optscls, optset, #show_help, subcommands, summary, #to_doc, usage
Instance Method Details
#find_entries_for_path(path, options) ⇒ Object
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
90
91
92
93
94
|
# File 'lib/pvn/log/command.rb', line 60
def find_entries_for_path path, options
cmdargs = Hash.new
cmdargs[:path] = path
[ :limit, :verbose, :revision ].each do |field|
cmdargs[field] = options.send field
end
if options.user
cmdargs[:limit] = nil
end
cmdargs[:use_cache] = false
logargs = SVNx::LogCommandArgs.new cmdargs
elmt = PVN::IO::Element.new :local => path || '.'
log = elmt.log logargs
entries = log.entries
info { "options: #{options}" }
info { "options.user: #{options.user}" }
if options.user
entries = find_entries_for_user entries, options.user, options.limit
info { "entries: #{entries}" }
from_head = nil
from_tail = nil
end
entries
end
|
#find_entries_for_user(entries, user, limit) ⇒ Object
96
97
98
99
100
101
102
103
104
|
# File 'lib/pvn/log/command.rb', line 96
def find_entries_for_user entries, user, limit
entries = entries.select { |entry| entry.author == user }
raise "ERROR: no matching log entries for '#{user}'" if entries.empty?
info { "entries: #{entries}" }
limit ? entries[0 ... limit] : entries
end
|
#init(options) ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/pvn/log/command.rb', line 34
def init options
paths = options.paths
paths = %w{ . } if paths.empty?
info "paths: #{paths}"
allentries = Array.new
paths.each do |path|
allentries.concat find_entries_for_path path, options
end
show_relative = !options.user && paths.size == 1 && !options.revision
from_head = show_relative
from_tail = show_relative && !options.limit
ef = PVN::Log::EntriesFormatter.new options.color, allentries, from_head, from_tail
puts ef.format
end
|