pvn 0.0.7 → 0.0.8

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.
Files changed (111) hide show
  1. data/bin/change.rb +50 -0
  2. data/bin/pvn +8 -4
  3. data/bin/quote.rb +18 -6
  4. data/bin/quotes.orig.txt +145 -0
  5. data/bin/quotes.txt +64 -0
  6. data/lib/pvn/app/runner.rb +103 -0
  7. data/lib/pvn/app.rb +1 -142
  8. data/lib/pvn/{subcommands/base → command}/color_option.rb +1 -1
  9. data/lib/pvn/{subcommands/base → command}/command.rb +10 -6
  10. data/lib/pvn/{subcommands/base → command}/doc.rb +2 -2
  11. data/lib/pvn/{subcommands/base → command}/options.rb +2 -2
  12. data/lib/pvn/config.rb +14 -1
  13. data/lib/pvn/{subcommands/diff → diff}/command.rb +6 -6
  14. data/lib/pvn/diff/differ.rb +60 -44
  15. data/lib/pvn/diff/local_differ.rb +99 -0
  16. data/lib/pvn/diff/log_paths.rb +46 -0
  17. data/lib/pvn/{subcommands/diff → diff}/options.rb +8 -6
  18. data/lib/pvn/diff/path.rb +52 -0
  19. data/lib/pvn/diff/path_revision.rb +31 -0
  20. data/lib/pvn/diff/paths.rb +42 -0
  21. data/lib/pvn/diff/repository_differ.rb +154 -0
  22. data/lib/pvn/diff/revision.rb +36 -0
  23. data/lib/pvn/diff/status_paths.rb +87 -0
  24. data/lib/pvn/io/element.rb +29 -8
  25. data/lib/pvn/{subcommands/log → log}/command.rb +4 -4
  26. data/lib/pvn/log/formatter/log_formatter.rb +1 -1
  27. data/lib/pvn/{subcommands/log → log}/options.rb +7 -7
  28. data/lib/pvn/{subcommands/pct → pct}/command.rb +6 -6
  29. data/lib/pvn/{subcommands/pct → pct}/diffcount.rb +1 -1
  30. data/lib/pvn/{subcommands/pct → pct}/differ.rb +2 -2
  31. data/lib/pvn/{subcommands/pct → pct}/local_differ.rb +3 -3
  32. data/lib/pvn/pct/options.rb +12 -0
  33. data/lib/pvn/{subcommands/pct → pct}/repository_differ.rb +5 -13
  34. data/lib/pvn/revision/{entry.rb → argument.rb} +45 -30
  35. data/lib/pvn/{subcommands/revision → revision}/base_option.rb +2 -2
  36. data/lib/pvn/revision/error.rb +11 -0
  37. data/lib/pvn/{subcommands/revision → revision}/multiple_revisions_option.rb +1 -1
  38. data/lib/pvn/revision/range.rb +49 -0
  39. data/lib/pvn/{subcommands/revision → revision}/revision_option.rb +1 -8
  40. data/lib/pvn/{subcommands/revision → revision}/revision_regexp_option.rb +2 -2
  41. data/lib/pvn/{subcommands/status → status}/command.rb +6 -6
  42. data/lib/pvn/status/formatter/status_formatter.rb +1 -1
  43. data/lib/pvn/status/options.rb +12 -0
  44. data/lib/pvn/{base/util.rb → util/array.rb} +2 -1
  45. data/lib/pvn.rb +1 -6
  46. data/lib/svnx/action.rb +52 -0
  47. data/lib/svnx/entries.rb +9 -1
  48. data/lib/svnx/log/command.rb +4 -3
  49. data/lib/svnx/status/entry.rb +30 -13
  50. data/lib/synoption/base_option.rb +10 -27
  51. data/lib/synoption/matchers.rb +22 -0
  52. data/lib/system/command/cachefile.rb +28 -14
  53. data/lib/system/command.rb +1 -1
  54. data/test/integration/pvn/diff/command_test.rb +20 -0
  55. data/test/integration/pvn/diff/local_differ_test.rb +72 -0
  56. data/test/integration/pvn/diff/log_paths_test.rb +28 -0
  57. data/test/integration/pvn/diff/repository_differ_test.rb +127 -0
  58. data/test/integration/pvn/diff/status_paths_test.rb +31 -0
  59. data/test/integration/pvn/log/command_test.rb +29 -0
  60. data/test/integration/pvn/pct/command_test.rb +30 -0
  61. data/test/integration/pvn/status/command_test.rb +26 -0
  62. data/test/unit/pvn/app_test.rb +7 -5
  63. data/test/unit/pvn/diff/path_revision_test.rb +45 -0
  64. data/test/unit/pvn/diff/path_test.rb +38 -0
  65. data/test/unit/pvn/diff/revision_test.rb +35 -0
  66. data/test/unit/pvn/io/element/log/log_test.rb +2 -2
  67. data/test/unit/pvn/log/formatter/entry_formatter_test.rb +40 -29
  68. data/test/unit/pvn/{subcommands/log → log}/options_test.rb +4 -4
  69. data/test/unit/pvn/revision/argument_test.rb +157 -0
  70. data/test/unit/pvn/{subcommands/revision → revision}/multiple_revisions_option_test.rb +10 -11
  71. data/test/unit/pvn/revision/range_test.rb +26 -0
  72. data/test/unit/pvn/{subcommands/revision → revision}/revision_option_test.rb +13 -18
  73. data/test/unit/pvn/{subcommands/revision → revision}/revision_regexp_option_test.rb +8 -10
  74. data/test/unit/svnx/action_test.rb +67 -0
  75. data/test/unit/svnx/info/entries_test.rb +10 -10
  76. data/test/unit/svnx/info/entry_test.rb +7 -10
  77. data/test/unit/svnx/log/entries_test.rb +31 -29
  78. data/test/unit/svnx/log/entry_test.rb +3 -7
  79. data/test/unit/svnx/status/entries_test.rb +7 -6
  80. data/test/unit/svnx/status/entry_test.rb +2 -23
  81. data/test/unit/system/command/cachefile_test.rb +53 -0
  82. data/test/unit/system/command/caching_test.rb +14 -23
  83. metadata +83 -64
  84. data/lib/pvn/describe.rb +0 -40
  85. data/lib/pvn/diff/diffcmd.rb +0 -49
  86. data/lib/pvn/diff/diffopts.rb +0 -58
  87. data/lib/pvn/log/logcmd.rb +0 -135
  88. data/lib/pvn/log/logentry.rb +0 -116
  89. data/lib/pvn/log/logfactory.rb +0 -101
  90. data/lib/pvn/log/logoptions.rb +0 -43
  91. data/lib/pvn/revision.rb +0 -119
  92. data/lib/pvn/subcommands/diff/differ.rb +0 -65
  93. data/lib/pvn/subcommands/diff/local_differ.rb +0 -103
  94. data/lib/pvn/subcommands/diff/repository_differ.rb +0 -145
  95. data/lib/pvn/subcommands/pct/clargs.rb +0 -33
  96. data/lib/pvn/subcommands/pct/options.rb +0 -12
  97. data/lib/pvn/subcommands/status/options.rb +0 -12
  98. data/lib/pvn/svn/command/svncmd.rb +0 -39
  99. data/lib/pvn/svn/environment.rb +0 -23
  100. data/lib/pvn/svn/svnelement.rb +0 -89
  101. data/lib/pvn/svn/svninfo.rb +0 -42
  102. data/lib/pvn/svn/svnroot.rb +0 -29
  103. data/lib/pvn/upp/uppcmd.rb +0 -112
  104. data/lib/pvn/wherecmd.rb +0 -55
  105. data/test/integration/pvn/subcommands/diff/command_test.rb +0 -153
  106. data/test/integration/pvn/subcommands/log/command_test.rb +0 -22
  107. data/test/integration/svnx/log/test.rb +0 -43
  108. data/test/unit/pvn/revision/entry_test.rb +0 -110
  109. /data/lib/pvn/{subcommands/base → command}/clargs.rb +0 -0
  110. /data/lib/pvn/{base → util}/color_formatter.rb +0 -0
  111. /data/lib/pvn/{base → util}/textlines.rb +0 -0
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: 17
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 7
10
- version: 0.0.7
9
+ - 8
10
+ version: 0.0.8
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-09-15 00:00:00 -04:00
18
+ date: 2012-09-30 00:00:00 -04:00
19
19
  default_executable: pvn
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -45,13 +45,17 @@ extra_rdoc_files:
45
45
  - README.markdown
46
46
  files:
47
47
  - bin/pvndiff
48
+ - bin/quotes.txt
48
49
  - bin/quote.rb
49
50
  - bin/pvn
51
+ - bin/quotes.orig.txt
52
+ - bin/change.rb
50
53
  - bin/modify_timestamps.rb
51
54
  - bin/populate.rb
52
55
  - lib/synoption/boolean_option.rb
53
56
  - lib/synoption/option.rb
54
57
  - lib/synoption/fixnum_option.rb
58
+ - lib/synoption/matchers.rb
55
59
  - lib/synoption/match.rb
56
60
  - lib/synoption/exception.rb
57
61
  - lib/synoption/base_option.rb
@@ -75,70 +79,63 @@ files:
75
79
  - lib/svnx/info/command.rb
76
80
  - lib/svnx/info/entries.rb
77
81
  - lib/svnx/info/entry.rb
82
+ - lib/svnx/action.rb
78
83
  - lib/svnx/entry.rb
79
84
  - lib/svnx/log/command.rb
80
85
  - lib/svnx/log/entries.rb
81
86
  - lib/svnx/log/entry.rb
82
- - lib/pvn/subcommands/status/options.rb
83
- - lib/pvn/subcommands/status/command.rb
84
- - lib/pvn/subcommands/base/options.rb
85
- - lib/pvn/subcommands/base/color_option.rb
86
- - lib/pvn/subcommands/base/clargs.rb
87
- - lib/pvn/subcommands/base/command.rb
88
- - lib/pvn/subcommands/base/doc.rb
89
- - lib/pvn/subcommands/diff/local_differ.rb
90
- - lib/pvn/subcommands/diff/options.rb
91
- - lib/pvn/subcommands/diff/repository_differ.rb
92
- - lib/pvn/subcommands/diff/command.rb
93
- - lib/pvn/subcommands/diff/differ.rb
94
- - lib/pvn/subcommands/pct/local_differ.rb
95
- - lib/pvn/subcommands/pct/options.rb
96
- - lib/pvn/subcommands/pct/repository_differ.rb
97
- - lib/pvn/subcommands/pct/clargs.rb
98
- - lib/pvn/subcommands/pct/diffcount.rb
99
- - lib/pvn/subcommands/pct/command.rb
100
- - lib/pvn/subcommands/pct/differ.rb
101
- - lib/pvn/subcommands/log/options.rb
102
- - lib/pvn/subcommands/log/command.rb
103
- - lib/pvn/subcommands/revision/base_option.rb
104
- - lib/pvn/subcommands/revision/revision_regexp_option.rb
105
- - lib/pvn/subcommands/revision/multiple_revisions_option.rb
106
- - lib/pvn/subcommands/revision/revision_option.rb
107
- - lib/pvn/describe.rb
87
+ - lib/pvn/command/options.rb
88
+ - lib/pvn/command/color_option.rb
89
+ - lib/pvn/command/clargs.rb
90
+ - lib/pvn/command/command.rb
91
+ - lib/pvn/command/doc.rb
92
+ - lib/pvn/app/runner.rb
93
+ - lib/pvn/util/array.rb
94
+ - lib/pvn/util/textlines.rb
95
+ - lib/pvn/util/color_formatter.rb
108
96
  - lib/pvn/config.rb
109
97
  - lib/pvn/cmddoc.rb
110
- - lib/pvn/revision.rb
98
+ - lib/pvn/status/options.rb
99
+ - lib/pvn/status/command.rb
111
100
  - lib/pvn/status/formatter/entry_formatter.rb
112
101
  - lib/pvn/status/formatter/status_formatter.rb
113
102
  - lib/pvn/status/formatter/entries_formatter.rb
114
- - lib/pvn/base/textlines.rb
115
- - lib/pvn/base/color_formatter.rb
116
- - lib/pvn/base/util.rb
117
- - lib/pvn/diff/diffcmd.rb
118
- - lib/pvn/diff/diffopts.rb
103
+ - lib/pvn/diff/log_paths.rb
104
+ - lib/pvn/diff/local_differ.rb
105
+ - lib/pvn/diff/paths.rb
106
+ - lib/pvn/diff/path.rb
107
+ - lib/pvn/diff/options.rb
108
+ - lib/pvn/diff/repository_differ.rb
109
+ - lib/pvn/diff/revision.rb
110
+ - lib/pvn/diff/command.rb
111
+ - lib/pvn/diff/path_revision.rb
119
112
  - lib/pvn/diff/differ.rb
113
+ - lib/pvn/diff/status_paths.rb
120
114
  - lib/pvn/io/element.rb
121
115
  - lib/pvn/io/fselement.rb
122
- - lib/pvn/wherecmd.rb
123
116
  - lib/pvn/app.rb
117
+ - lib/pvn/pct/local_differ.rb
118
+ - lib/pvn/pct/options.rb
119
+ - lib/pvn/pct/repository_differ.rb
120
+ - lib/pvn/pct/diffcount.rb
121
+ - lib/pvn/pct/command.rb
122
+ - lib/pvn/pct/differ.rb
124
123
  - lib/pvn/doc.rb
125
- - lib/pvn/log/logentry.rb
126
- - lib/pvn/log/logcmd.rb
127
- - lib/pvn/log/logfactory.rb
128
- - lib/pvn/log/logoptions.rb
124
+ - lib/pvn/log/options.rb
125
+ - lib/pvn/log/command.rb
129
126
  - lib/pvn/log/formatter/entry_formatter.rb
130
127
  - lib/pvn/log/formatter/summary_formatter.rb
131
128
  - lib/pvn/log/formatter/entries_formatter.rb
132
129
  - lib/pvn/log/formatter/message_formatter.rb
133
130
  - lib/pvn/log/formatter/log_formatter.rb
134
131
  - lib/pvn/log/formatter/path_formatter.rb
135
- - lib/pvn/svn/svninfo.rb
136
- - lib/pvn/svn/command/svncmd.rb
137
- - lib/pvn/svn/svnroot.rb
138
- - lib/pvn/svn/svnelement.rb
139
- - lib/pvn/svn/environment.rb
140
- - lib/pvn/revision/entry.rb
141
- - lib/pvn/upp/uppcmd.rb
132
+ - lib/pvn/revision/range.rb
133
+ - lib/pvn/revision/argument.rb
134
+ - lib/pvn/revision/base_option.rb
135
+ - lib/pvn/revision/revision_regexp_option.rb
136
+ - lib/pvn/revision/error.rb
137
+ - lib/pvn/revision/multiple_revisions_option.rb
138
+ - lib/pvn/revision/revision_option.rb
142
139
  - lib/pvn.rb
143
140
  - test/unit/synoption/set_test.rb
144
141
  - test/unit/synoption/match_test.rb
@@ -146,24 +143,35 @@ files:
146
143
  - test/unit/synoption/option_test.rb
147
144
  - test/unit/system/command/caching_test.rb
148
145
  - test/unit/system/command/line_test.rb
146
+ - test/unit/system/command/cachefile_test.rb
149
147
  - test/unit/svnx/status/entries_test.rb
150
148
  - test/unit/svnx/status/entry_test.rb
149
+ - test/unit/svnx/action_test.rb
151
150
  - test/unit/svnx/info/entries_test.rb
152
151
  - test/unit/svnx/info/entry_test.rb
153
152
  - test/unit/svnx/log/entries_test.rb
154
153
  - test/unit/svnx/log/entry_test.rb
155
154
  - test/unit/svnx/log/cmargs_test.rb
156
- - test/unit/pvn/subcommands/log/options_test.rb
157
- - test/unit/pvn/subcommands/revision/multiple_revisions_option_test.rb
158
- - test/unit/pvn/subcommands/revision/revision_regexp_option_test.rb
159
- - test/unit/pvn/subcommands/revision/revision_option_test.rb
155
+ - test/unit/pvn/diff/revision_test.rb
156
+ - test/unit/pvn/diff/path_test.rb
157
+ - test/unit/pvn/diff/path_revision_test.rb
160
158
  - test/unit/pvn/io/element/log/log_test.rb
159
+ - test/unit/pvn/log/options_test.rb
161
160
  - test/unit/pvn/log/formatter/entry_formatter_test.rb
162
161
  - test/unit/pvn/app_test.rb
163
- - test/unit/pvn/revision/entry_test.rb
164
- - test/integration/svnx/log/test.rb
165
- - test/integration/pvn/subcommands/diff/command_test.rb
166
- - test/integration/pvn/subcommands/log/command_test.rb
162
+ - test/unit/pvn/revision/argument_test.rb
163
+ - test/unit/pvn/revision/range_test.rb
164
+ - test/unit/pvn/revision/multiple_revisions_option_test.rb
165
+ - test/unit/pvn/revision/revision_regexp_option_test.rb
166
+ - test/unit/pvn/revision/revision_option_test.rb
167
+ - test/integration/pvn/status/command_test.rb
168
+ - test/integration/pvn/diff/repository_differ_test.rb
169
+ - test/integration/pvn/diff/local_differ_test.rb
170
+ - test/integration/pvn/diff/log_paths_test.rb
171
+ - test/integration/pvn/diff/status_paths_test.rb
172
+ - test/integration/pvn/diff/command_test.rb
173
+ - test/integration/pvn/pct/command_test.rb
174
+ - test/integration/pvn/log/command_test.rb
167
175
  - README.markdown
168
176
  has_rdoc: true
169
177
  homepage: http://www.incava.org/projects/pvn
@@ -206,21 +214,32 @@ test_files:
206
214
  - test/unit/synoption/option_test.rb
207
215
  - test/unit/system/command/caching_test.rb
208
216
  - test/unit/system/command/line_test.rb
217
+ - test/unit/system/command/cachefile_test.rb
209
218
  - test/unit/svnx/status/entries_test.rb
210
219
  - test/unit/svnx/status/entry_test.rb
220
+ - test/unit/svnx/action_test.rb
211
221
  - test/unit/svnx/info/entries_test.rb
212
222
  - test/unit/svnx/info/entry_test.rb
213
223
  - test/unit/svnx/log/entries_test.rb
214
224
  - test/unit/svnx/log/entry_test.rb
215
225
  - test/unit/svnx/log/cmargs_test.rb
216
- - test/unit/pvn/subcommands/log/options_test.rb
217
- - test/unit/pvn/subcommands/revision/multiple_revisions_option_test.rb
218
- - test/unit/pvn/subcommands/revision/revision_regexp_option_test.rb
219
- - test/unit/pvn/subcommands/revision/revision_option_test.rb
226
+ - test/unit/pvn/diff/revision_test.rb
227
+ - test/unit/pvn/diff/path_test.rb
228
+ - test/unit/pvn/diff/path_revision_test.rb
220
229
  - test/unit/pvn/io/element/log/log_test.rb
230
+ - test/unit/pvn/log/options_test.rb
221
231
  - test/unit/pvn/log/formatter/entry_formatter_test.rb
222
232
  - test/unit/pvn/app_test.rb
223
- - test/unit/pvn/revision/entry_test.rb
224
- - test/integration/svnx/log/test.rb
225
- - test/integration/pvn/subcommands/diff/command_test.rb
226
- - test/integration/pvn/subcommands/log/command_test.rb
233
+ - test/unit/pvn/revision/argument_test.rb
234
+ - test/unit/pvn/revision/range_test.rb
235
+ - test/unit/pvn/revision/multiple_revisions_option_test.rb
236
+ - test/unit/pvn/revision/revision_regexp_option_test.rb
237
+ - test/unit/pvn/revision/revision_option_test.rb
238
+ - test/integration/pvn/status/command_test.rb
239
+ - test/integration/pvn/diff/repository_differ_test.rb
240
+ - test/integration/pvn/diff/local_differ_test.rb
241
+ - test/integration/pvn/diff/log_paths_test.rb
242
+ - test/integration/pvn/diff/status_paths_test.rb
243
+ - test/integration/pvn/diff/command_test.rb
244
+ - test/integration/pvn/pct/command_test.rb
245
+ - test/integration/pvn/log/command_test.rb
data/lib/pvn/describe.rb DELETED
@@ -1,40 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # -*- ruby -*-
3
-
4
- require 'system/command'
5
- # require 'pvn/diff'
6
-
7
- module PVN
8
- class DescribeCommand < Command
9
- COMMAND = "describe"
10
-
11
- self.doc do |doc|
12
- doc.subcommands = [ COMMAND, 'desc' ]
13
- doc.description = "Describes the changes of one or more revisions."
14
- doc.usage = "[OPTIONS] FILE..."
15
- doc.summary = [ " Prints the log message and the files changed for the given",
16
- " revisions." ]
17
- doc.examples << [ "pvn describe -1 foo.rb", "Prints the summary for the most recent revision of foo.rb." ]
18
- end
19
-
20
- # has_option :limit, '-l', "the number of log entries", DEFAULT_LIMIT, :negate => [ %r{^--no-?limit} ]
21
- has_revision_option :multiple => true
22
-
23
- def initialize args = Hash.new
24
- info "args: #{args}".on_blue
25
- super
26
- end
27
-
28
- def run args
29
- info "args: #{args}".on_yellow
30
- revisions = find_option(:revision).value
31
-
32
- info "revisions: #{revisions}".yellow
33
-
34
- revisions.each do |rev|
35
- info "svn log -r #{rev}"
36
- info "svn diff --summarize -c #{rev}"
37
- end
38
- end
39
- end
40
- end
@@ -1,49 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # -*- ruby -*-
3
-
4
- require 'pvn/config'
5
- require 'pvn/svn/command/svncmd'
6
- require 'pvn/diff/diffopts'
7
-
8
- module PVN
9
- class DiffCommand < SVNCommand
10
- COMMAND = "diff"
11
-
12
- attr_reader :options
13
-
14
- self.doc do |doc|
15
- doc.subcommands = [ COMMAND ]
16
- doc.description = "Displays differences between revisions."
17
- doc.usage = "[OPTIONS] FILE..."
18
- doc.summary = [ "Compare two revisions, filtering through external programs.",
19
- "For each file compared, the file extension is used to find",
20
- "a diff program." ]
21
- doc.options.concat DiffOptionSet.new.options
22
- doc.examples << [ "pvn diff foo.rb", "Compares foo.rb against the last updated version." ]
23
- doc.examples << [ "pvn diff -3 StringExt.java", "Compares StringExt.java at change (HEAD - 3), using a Java-specific program such as DiffJ." ]
24
- doc.examples << [ "pvn diff -r +4 -w", "Compares the 4th revision against the working copy, ignoring whitespace." ]
25
- end
26
-
27
- def initialize args = Hash.new
28
- @options = DiffOptionSet.new
29
- debug "args: #{args.inspect}".yellow
30
-
31
- super
32
- end
33
-
34
- def use_cache?
35
- super && !against_head?
36
- end
37
-
38
- def against_head?
39
- @options.change.value.nil? && @options.revision.head?
40
- end
41
-
42
- # @todo implement
43
- if true
44
- self.options do |opts|
45
- # opts.add :diffcmd
46
- end
47
- end
48
- end
49
- end
@@ -1,58 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # -*- ruby -*-
3
-
4
- require 'synoption/set'
5
- require 'pvn/subcommands/revision/revision_option'
6
-
7
- module PVN
8
- thisfile = Pathname.new __FILE__
9
- PVNDIFF_CMD = (thisfile.parent.parent.parent.parent + "bin/pvndiff").expand_path
10
-
11
- POS_NEG_NUMERIC_RE = Regexp.new('^[\-\+]?\d+$')
12
-
13
- # "pvn diff -3" == "pvn diff -c -3", not "pvn diff -r -3", because
14
- # we diff for the change, not from that revision to head.
15
-
16
- class DiffRevisionOption < RevisionOption
17
- def head?
18
- value.nil? || value == 'HEAD'
19
- end
20
- end
21
-
22
- class DiffChangeOption < Option
23
- def initialize chgargs = Hash.new
24
- chgargs[:setter] = :revision_from_args
25
- chgargs[:regexp] = POS_NEG_NUMERIC_RE
26
-
27
- super :change, '-c', "change", chgargs
28
- end
29
- end
30
-
31
- class DiffWhitespaceOption < Option
32
- def initialize wsargs = Hash.new
33
- super :whitespace, '-W', "ignore all whitespace", wsargs
34
- end
35
-
36
- def to_command_line
37
- if value
38
- %w{ -x -w -x -b -x --ignore-eol-style }
39
- end
40
- end
41
- end
42
-
43
- class DiffOptionSet < OptionSet
44
- attr_reader :change
45
- attr_reader :revision
46
-
47
- def initialize
48
- super
49
-
50
- # diffcmd is old/new option style (non-subclass of Option)
51
- diffcmd = PVNDIFF_CMD.exist? && PVNDIFF_CMD
52
- @diffcmdopt = add Option.new :diffcmd, "--diff-cmd", "the program to run diff through", diffcmd, :negate => [ %r{^--no-?diff-?cmd} ]
53
- @change = add DiffChangeOption.new
54
- @revision = add DiffRevisionOption.new
55
- @whitespace = add DiffWhitespaceOption.new
56
- end
57
- end
58
- end
@@ -1,135 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # -*- ruby -*-
3
-
4
- require 'system/command'
5
- require 'system/cachecmd'
6
- require 'pvn/svn/command/svncmd'
7
- require 'pvn/log/logfactory'
8
- require 'pvn/log/logoptions'
9
-
10
- module PVN
11
- class LogCommand < SVNCommand
12
- COMMAND = "log"
13
- REVISION_ARG = '-r'
14
-
15
- attr_reader :options
16
-
17
- self.doc do |doc|
18
- doc.subcommands = [ COMMAND, 'l' ]
19
- doc.description = "Print log messages for the given files."
20
- doc.usage = "[OPTIONS] FILE..."
21
- doc.summary = [ "Prints the log entries for the given files, with colorized",
22
- "output. Unlike 'svn log', which prints all log entries, ",
23
- "'pvn log' prints #{DEFAULT_LIMIT} entries by default.",
24
- "As with other pvn commands, 'pvn log' accepts relative ",
25
- "revisions."
26
- ]
27
- doc.options.concat LogOptionSet.new.options
28
- doc.examples << [ "pvn log foo.rb", "Prints the latest #{DEFAULT_LIMIT} log entries for foo.rb." ]
29
- doc.examples << [ "pvn log -l 25 foo.rb", "Prints 25 log entries for the file." ]
30
- doc.examples << [ "pvn log -3 foo.rb", "Prints the log entry for revision (HEAD - 3)." ]
31
- doc.examples << [ "pvn log +3 foo.rb", "Prints the 3rd log entry." ]
32
- doc.examples << [ "pvn log -l 10 -F", "Prints the latest 10 entries, unformatted." ]
33
- doc.examples << [ "pvn log -r 122 -v", "Prints log entry for revision 122, with the files in that change." ]
34
- end
35
-
36
- def initialize args = Hash.new
37
- @options = LogOptionSet.new
38
-
39
- debug "args: #{args.inspect}"
40
-
41
- @options.revision.fromdate = args[:fromdate]
42
- @options.revision.todate = args[:todate]
43
-
44
- @options.options.each do |opt|
45
- info "opt: #{opt}".blue
46
- end
47
-
48
- @entries = nil
49
-
50
- super
51
- end
52
-
53
- def has_entries?
54
- true
55
- end
56
-
57
- def use_cache?
58
- # use cache unless log is to head.
59
- super && !@options.revision.head?
60
- end
61
-
62
- def entries
63
- @entries ||= begin
64
- # of course this assumes that output is in plain text (non-XML)
65
- factory = PVN::Log::TextFactory.new output
66
- factory.entries
67
- end
68
- end
69
-
70
- def revision_of_nth_entry num
71
- entry = nth_entry num
72
- entry && entry.revision.to_i
73
- end
74
-
75
- def nth_entry n
76
- entries[-1 * n]
77
- end
78
-
79
- def write_entries
80
- info "@options: #{@options.inspect}"
81
- info "@options.format: #{@options.format.inspect}".yellow
82
-
83
- entries.each do |entry|
84
- info "@options.format.value: #{@options.format.value}"
85
- entry.write @options.format.value
86
- end
87
- unless @options.format
88
- puts PVN::Log::Entry::BANNER
89
- end
90
- end
91
-
92
- # this may be faster than get_nth_entry
93
- def read_from_log_output n_matches
94
- loglines = output.reverse
95
-
96
- entries = entries
97
- entry = entries[-1 * n_matches]
98
-
99
- if true
100
- return entry && entry.revision.to_i
101
- end
102
-
103
- loglines.each do |line|
104
- next unless md = SVN_LOG_SUMMARY_LINE_RE.match(line)
105
-
106
- info "md: #{md}".yellow
107
-
108
- n_matches -= 1
109
- if n_matches == 0
110
- return md[1].to_i
111
- end
112
- end
113
- nil
114
- end
115
- end
116
- end
117
-
118
- module PVN::Log
119
- class Command < CachableCommand
120
- def initialize args
121
- command = %w{ svn log }
122
-
123
- # todo: handle revision conversion:
124
- fromrev = args[:fromrev]
125
- torev = args[:torev]
126
-
127
- if fromrev && torev
128
- command << "-r" << "#{fromrev}:#{torev}"
129
- elsif args[:fromdate] && args[:todate]
130
- command << "-r" << "\{#{fromdate}\}:\{#{todate}\}"
131
- end
132
- debug "command: #{command}".on_red
133
- end
134
- end
135
- end
@@ -1,116 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # -*- ruby -*-
3
-
4
- require 'rubygems'
5
- require 'riel'
6
- require 'pvn/config'
7
-
8
- module PVN; module Log; end; end
9
-
10
- module PVN::Log
11
- class Entry
12
- include Loggable
13
-
14
- FIELDS = [ :revision,
15
- :user,
16
- :date,
17
- :time,
18
- :tz,
19
- :dtg,
20
- :nlines,
21
- :files,
22
- :comment ]
23
-
24
- FIELDS.each do |field|
25
- attr_reader field
26
- end
27
-
28
- WRITE_FORMAT_DEFAULT = ('#{revision.yellow}\t#{user.green}\t#{date} #{time}\n' +
29
- '#{list(comment)}#{cr(files)}' +
30
- '#{list(files, :blue, :on_yellow)}\n')
31
-
32
- WRITE_SUMMARY_LINE = 'r#{revision} | #{user} | #{date} #{time} #{tz} (#{dtg}) | #{nlines} #{nlines.to_i == 1 ? "line" : "lines"}\n'
33
-
34
- WRITE_UNFORMATTED_VERBOSE = (WRITE_SUMMARY_LINE +
35
- 'Changed Paths:\n' +
36
- '#{list(files)}\n' +
37
- '#{plainlist(comment)}')
38
-
39
- WRITE_UNFORMATTED_TERSE = (WRITE_SUMMARY_LINE + '\n' +
40
- '#{plainlist(comment)}')
41
-
42
- BANNER = '-' * 72
43
-
44
- def set_from_args name, args
45
- self.instance_variable_set '@' + name.to_s, args[name]
46
- end
47
-
48
- # Reads a log entry from the text, starting at the first line at or after
49
- # lidx, matching the svn log separator line. Returns [ entry, new_index ],
50
- # where new_index is the updated index into the lines. Returns nil if the
51
- # text does not match the expected plain text format.
52
- def self.create_from_text lines, lidx = 0
53
- return TextOutputReader.create_from_text lines, lidx
54
- end
55
-
56
- def initialize args = Hash.new
57
- FIELDS.each do |field|
58
- set_from_args field, args
59
- end
60
- end
61
-
62
- def cr ary
63
- ary && !ary.empty? ? "\n" : ''
64
- end
65
-
66
- def list lines, *colors
67
- return '' unless lines
68
-
69
- lines.collect do |line|
70
- ln = line.chomp
71
- colors.each do |color|
72
- ln = ln.send(color)
73
- end
74
- " " + ln + "\n"
75
- end.join('')
76
- end
77
-
78
- def plainlist lines
79
- return '' unless lines
80
-
81
- # ensure that each has a newline
82
- lines.collect do |line|
83
- line.chomp + "\n"
84
- end.join('')
85
- end
86
-
87
- def write formatted
88
- # ------------------------------------------------------------------------
89
- # r1907 | hielke.hoeve@gmail.com | 2011-11-14 05:50:38 -0500 (Mon, 14 Nov 2011) | 1 line
90
- #
91
- # back to dev
92
-
93
- if formatted
94
- cfg = PVN::Configuration.read
95
-
96
- logcfg = cfg.section "log"
97
- info "logcfg: #{logcfg}"
98
- format = logcfg && logcfg.assoc('format') && logcfg.assoc('format')[1]
99
- info "format: #{format}"
100
-
101
- format ||= WRITE_FORMAT_DEFAULT
102
-
103
- # @todo allow reformatting of date and time
104
- # format = WRITE_FORMAT_DEFAULT
105
- msg = eval('"' + format + '"')
106
- print msg
107
- else
108
- puts BANNER
109
-
110
- fmt = files ? WRITE_UNFORMATTED_VERBOSE : WRITE_UNFORMATTED_TERSE
111
-
112
- puts eval('"' + fmt + '"')
113
- end
114
- end
115
- end
116
- end