pvn 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,6 +32,7 @@ module PVN::Subcommands::Log
32
32
  example "pvn log +3 foo.rb", "Prints the 3rd log entry."
33
33
  example "pvn log -l 10 -F", "Prints the latest 10 entries, uncolorized."
34
34
  example "pvn log -r 122 -v", "Prints log entry for revision 122, with the files in that change."
35
+ example "pvn log -u barney", "Prints log entries only for user 'barney'."
35
36
 
36
37
  def initialize args
37
38
  options = PVN::Subcommands::Log::OptionSet.new
@@ -46,24 +47,47 @@ module PVN::Subcommands::Log
46
47
  [ :limit, :verbose, :revision ].each do |field|
47
48
  cmdargs[field] = options.send field
48
49
  end
50
+
51
+ if options.user
52
+ cmdargs[:limit] = nil
53
+ end
49
54
 
50
55
  # we can't cache this, because we don't know if there has been an svn
51
56
  # update since the previous run:
52
57
  cmdargs[:use_cache] = false
53
58
 
54
- logargs = SVNx::LogCommandArgs.new cmdargs
55
- elmt = PVN::IO::Element.new :local => path || '.'
56
- log = elmt.log logargs
57
- nentries = log.entries.size
59
+ logargs = SVNx::LogCommandArgs.new cmdargs
60
+ elmt = PVN::IO::Element.new :local => path || '.'
61
+ log = elmt.log logargs
62
+ entries = log.entries
58
63
 
59
- # this should be refined to options.revision.head? && options.limit
64
+ # this should be refined to options.revision.head?
60
65
  from_head = !options.revision
61
66
  from_tail = !options.limit && !options.revision
62
-
63
- # this dictates whether to show +N and/or -1:
64
- totalentries = options.limit || options.revision ? nil : nentries
65
67
 
66
- ef = PVN::Log::EntriesFormatter.new options.format, log.entries, from_head, from_tail
68
+ info "options: #{options}".red
69
+ info "options.user: #{options.user}".red
70
+
71
+ if options.user
72
+ info "entries: #{entries}".red
73
+
74
+ entries = entries.select { |entry| entry.author == options.user }
75
+
76
+ raise "ERROR: no matching log entries for '#{options.user}'"
77
+
78
+ info "entries: #{entries}".red
79
+
80
+ # don't show relative revisions, since we've got a slice out of the list:
81
+ from_head = nil
82
+ from_tail = nil
83
+
84
+ if options.limit
85
+ entries = entries[0 ... options.limit]
86
+ info "entries: #{entries}".red
87
+ end
88
+ end
89
+
90
+ ef = PVN::Log::EntriesFormatter.new options.format, entries, from_head, from_tail
67
91
  puts ef.format
68
92
  end
69
93
  end
@@ -29,11 +29,18 @@ module PVN::Subcommands::Log
29
29
  end
30
30
  end
31
31
 
32
+ class UserOption < PVN::Option
33
+ def initialize optargs = Hash.new
34
+ super :user, '-u', "show only changes for the given user", nil, :as_cmdline_option => nil
35
+ end
36
+ end
37
+
32
38
  class OptionSet < PVN::Subcommands::Base::OptionSet
33
39
  has_option :revision, PVN::MultipleRevisionsRegexpOption, [ :unsets => :limit ]
34
40
  has_option :format, FormatOption
35
41
  has_option :help, PVN::Subcommands::Base::HelpOption
36
42
  has_option :limit, LimitOption
43
+ has_option :user, UserOption
37
44
  has_option :verbose, PVN::BooleanOption, [ :verbose, '-v', [ "include the files in the change" ], false ]
38
45
 
39
46
  def paths
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pvn
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeff Pace
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-08-31 00:00:00 -04:00
18
+ date: 2012-09-01 00:00:00 -04:00
19
19
  default_executable: pvn
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -34,7 +34,7 @@ dependencies:
34
34
  version: 1.1.6
35
35
  type: :runtime
36
36
  version_requirements: *id001
37
- description:
37
+ description: A set of extensions to the Subversion command line.
38
38
  email: jeugenepace@gmail.com
39
39
  executables:
40
40
  - pvn