svn-command 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme +70 -1
- data/bin/svn +1 -1
- data/lib/subversion.rb +20 -4
- data/lib/subversion_extensions.rb +1 -1
- data/lib/svn_command.rb +26 -5
- data/test/shared/test_helper.rb +1 -1
- data/test/shared/test_helpers/test_colorizer.rb +1 -1
- data/test/test_helper.rb +1 -1
- metadata +4 -4
- data/lib/attribute_accessors.rb +0 -44
data/Readme
CHANGED
@@ -204,6 +204,59 @@ You can now do commands like this:
|
|
204
204
|
|
205
205
|
(The standard svn command only accepts a single source and a single destination.)
|
206
206
|
|
207
|
+
=== <tt>commit</tt>
|
208
|
+
|
209
|
+
==== --skip-notification / --covert
|
210
|
+
|
211
|
+
Added a --skip-notification / --covert option which (assuming you have your post-commit hook set up to do this), will suppress the sending out of a commit notification e-mail.
|
212
|
+
|
213
|
+
This is useful if you're committing large/binary files that would normally cause the commit mailer to hang. (True, the commit mailer script should really be smart enough not to hang in the first place, but let's assume we don't have the luxury of being able to fix it...)
|
214
|
+
|
215
|
+
For this option to have any effect, you will need to set up your repository similar to this:
|
216
|
+
|
217
|
+
/var/www/svn/code/hooks/pre-revprop-change
|
218
|
+
|
219
|
+
REPOS="$1"
|
220
|
+
REV="$2"
|
221
|
+
USER="$3"
|
222
|
+
PROPNAME="$4"
|
223
|
+
ACTION="$5"
|
224
|
+
|
225
|
+
if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
|
226
|
+
if [ "$PROPNAME" = "svn:skip_commit_notification_for_next_commit" ]; then exit 0; fi
|
227
|
+
|
228
|
+
echo "Changing revision properties other than those listed in $0 is prohibited" >&2
|
229
|
+
exit 1
|
230
|
+
|
231
|
+
/var/www/svn/code/hooks/post-commit
|
232
|
+
|
233
|
+
#!/bin/bash
|
234
|
+
|
235
|
+
REPOS="$1"
|
236
|
+
REV="$2"
|
237
|
+
|
238
|
+
previous_revision=`expr $REV - 1`
|
239
|
+
skip_commit_notification=`svnlook propget $REPOS --revprop svn:skip_commit_notification_for_next_commit -r $previous_revision`
|
240
|
+
|
241
|
+
if [[ $skip_commit_notification == 'true' ]]; then
|
242
|
+
# Skipping
|
243
|
+
else
|
244
|
+
svnnotify \
|
245
|
+
--repos-path $REPOS \
|
246
|
+
--revision $REV \
|
247
|
+
--subject-prefix "[your repository name]" \
|
248
|
+
--revision-url 'http://code/?rev=%s' \
|
249
|
+
--to code-commit-watchers@yourdomain.com \
|
250
|
+
--handler HTML::ColorDiff \
|
251
|
+
--subject-cx \
|
252
|
+
--with-diff \
|
253
|
+
--author-url 'mailto:%s' \
|
254
|
+
--footer "Powered by SVN-Notify <http://search.cpan.org/~dwheeler/SVN-Notify-2.62/lib/SVN/Notify.pm>" \
|
255
|
+
--max-diff-length 1000
|
256
|
+
fi
|
257
|
+
|
258
|
+
|
259
|
+
|
207
260
|
===Help
|
208
261
|
|
209
262
|
You can, of course, get a lits of the custom commands that have been added by using <tt>svn help</tt>. They will be listed at the end.
|
@@ -212,7 +265,7 @@ You can, of course, get a lits of the custom commands that have been added by us
|
|
212
265
|
|
213
266
|
* --no-color (since color is on by default)
|
214
267
|
* --dry-run (see what /usr/bin/svn command it _would_ have executed if you weren't just doing a dry run -- useful for debugging if nothing else)
|
215
|
-
* --
|
268
|
+
* --print-commands (prints out the /usr/bin/svn commands before executing them)
|
216
269
|
* --debug (sets $debug = true)
|
217
270
|
|
218
271
|
==<tt>colordiff</tt>
|
@@ -249,6 +302,22 @@ This is a limitation of Console::Command.
|
|
249
302
|
Fix: Show the whole thing, including this line:
|
250
303
|
Fetching external item into 'glass/rails_backend/vendor/plugins/our_extensions'
|
251
304
|
|
305
|
+
|
306
|
+
This doesn't work:
|
307
|
+
svn propget svn:skip_commit_notification_for_next_commit --revprop -r 2498 http://code.qualitysmith.com/ --dry-run
|
308
|
+
In execute(). Was about to execute this command via method :exec:
|
309
|
+
"/usr/bin/svn propget --revprop -r 2498 http://code.qualitysmith.com/ svn:skip_commit_notification_for_next_commit"
|
310
|
+
|
311
|
+
> svn propget svn:skip_commit_notification_for_next_commit --revprop -r 2498 http://code.qualitysmith.com/
|
312
|
+
svn: Either a URL or versioned item is required
|
313
|
+
|
314
|
+
Have to do:
|
315
|
+
svn propget svn:skip_commit_notification_for_next_commit http://code.qualitysmith.com/applications/profiler_test --revprop -r 2498
|
316
|
+
|
317
|
+
or
|
318
|
+
> /usr/bin/svn propget svn:skip_commit_notification_for_next_commit --revprop -r 2498 http://code.qualitysmith.com/
|
319
|
+
|
320
|
+
|
252
321
|
=== Slowness
|
253
322
|
|
254
323
|
Is it slower than just running /usr/bin/svn directly? You betcha it is!
|
data/bin/svn
CHANGED
data/lib/subversion.rb
CHANGED
@@ -6,19 +6,20 @@ require 'rexml/document'
|
|
6
6
|
require 'rexml/xpath'
|
7
7
|
require 'rubygems'
|
8
8
|
|
9
|
-
|
9
|
+
gem 'facets', '>=1.8.51'
|
10
10
|
require 'facets/core/kernel/require_local'
|
11
11
|
require 'facets/core/enumerable/uniq_by'
|
12
12
|
require 'facets/core/kernel/silence_stream'
|
13
13
|
|
14
|
-
|
14
|
+
gem 'qualitysmith_extensions', '>=0.0.3'
|
15
15
|
|
16
16
|
# Had a lot of trouble getting ActiveSupport to load without giving errors! Eventually gave up on that idea since I only needed it for mattr_accessor and Facets supplies that.
|
17
|
-
#
|
17
|
+
#gem 'activesupport' # mattr_accessor
|
18
18
|
#require 'active_support'
|
19
19
|
#require 'active_support/core_ext/module/attribute_accessors'
|
20
20
|
#require 'facets/core/class/cattr'
|
21
|
-
|
21
|
+
gem 'qualitysmith_extensions'
|
22
|
+
require 'qualitysmith_extensions/module/attribute_accessors'
|
22
23
|
|
23
24
|
# Wraps the Subversion shell commands for Ruby.
|
24
25
|
module Subversion
|
@@ -267,6 +268,12 @@ module Subversion
|
|
267
268
|
#
|
268
269
|
end
|
269
270
|
|
271
|
+
def self.print_commands_for(&block)
|
272
|
+
old_print_commands, @@print_commands = @@print_commands, true
|
273
|
+
yield
|
274
|
+
@@print_commands = old_print_commands
|
275
|
+
end
|
276
|
+
|
270
277
|
protected
|
271
278
|
def self.execute(*args)
|
272
279
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
@@ -323,6 +330,15 @@ protected
|
|
323
330
|
end
|
324
331
|
end
|
325
332
|
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
326
342
|
module Subversion
|
327
343
|
# Represents an "externals container", which is a directory that has the <tt>svn:externals</tt> property set to something useful.
|
328
344
|
# Each ExternalsContainer contains a set of "entries", which are the actual directories listed in the <tt>svn:externals</tt>
|
data/lib/svn_command.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
|
-
|
3
|
+
gem 'facets', '>=1.8.51'
|
4
4
|
#require 'facets/more/command' # Not until they include my changes
|
5
5
|
require 'facets/core/string/margin'
|
6
6
|
require 'facets/core/kernel/require_local'
|
7
7
|
require 'facets/core/array/select' # select!
|
8
8
|
require 'facets/core/kernel/with' # returning
|
9
9
|
|
10
|
-
|
10
|
+
gem 'qualitysmith_extensions', '>=0.0.3'
|
11
11
|
require 'qualitysmith_extensions/enumerable/enum'
|
12
12
|
require 'qualitysmith_extensions/array/expand_ranges'
|
13
13
|
require 'qualitysmith_extensions/array/shell_escape'
|
@@ -19,7 +19,7 @@ require 'English'
|
|
19
19
|
require 'pp'
|
20
20
|
require 'termios'
|
21
21
|
require 'stringio'
|
22
|
-
|
22
|
+
gem 'colored'
|
23
23
|
require 'colored' # Lets us do "a".white.bold instead of "\033[1ma\033[0m"
|
24
24
|
require_local '../lib/subversion'
|
25
25
|
require_local '../lib/subversion_extensions'
|
@@ -96,9 +96,14 @@ module Subversion
|
|
96
96
|
def __dry_run
|
97
97
|
Subversion::dry_run = true
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
|
+
def __print_commands
|
100
101
|
Subversion::print_commands = true
|
101
102
|
end
|
103
|
+
# Don't want to hide svn's own -v/--verbose flag
|
104
|
+
alias_method :__Verbose, :__print_commands
|
105
|
+
alias_method :__show_commands, :__print_commands
|
106
|
+
alias_method :_V, :__print_commands
|
102
107
|
|
103
108
|
#-----------------------------------------------------------------------------------------------------------------------------
|
104
109
|
# Default/dynamic behavior
|
@@ -182,9 +187,20 @@ module Subversion
|
|
182
187
|
[:__encoding] => 1,
|
183
188
|
}.merge(SvnCommand::standard_remote_command_options), self
|
184
189
|
)
|
190
|
+
def __skip_notification
|
191
|
+
@skip_notification = true
|
192
|
+
end
|
193
|
+
alias_method :__covert, :__skip_notification
|
185
194
|
end
|
186
195
|
def commit(*args)
|
196
|
+
Subversion.print_commands_for do
|
197
|
+
svn :capture, "propset svn:skip_commit_notification_for_next_commit true --revprop -r #{Subversion.latest_revision}", :prepare_args => false
|
198
|
+
end if @skip_notification
|
187
199
|
svn :exec, 'commit', *(['--force-log'] + args)
|
200
|
+
|
201
|
+
# :todo:
|
202
|
+
# Add some logic to automatically skip the commit e-mail if the size of the files to be committed exceeds a threshold of __ MB.
|
203
|
+
# (Performance idea: Only check the size of the files if svn st includes (bin)?)
|
188
204
|
end
|
189
205
|
|
190
206
|
# Ideas:
|
@@ -756,9 +772,14 @@ End
|
|
756
772
|
private
|
757
773
|
def svn(method, *args)
|
758
774
|
subcommand = args[0]
|
775
|
+
options = args.last.is_a?(Hash) ? args.last : {}
|
759
776
|
args = (
|
760
777
|
[subcommand] +
|
761
|
-
|
778
|
+
(
|
779
|
+
(options[:prepare_args] == false) ?
|
780
|
+
[] :
|
781
|
+
(prepare_args(args[1..-1] || []))
|
782
|
+
) +
|
762
783
|
[:method => method]
|
763
784
|
)
|
764
785
|
# puts "in svn(): about to call Subversion#execute(#{args.inspect})"
|
data/test/shared/test_helper.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -7,7 +7,7 @@ require 'stubba'
|
|
7
7
|
$LOAD_PATH << File.dirname(__FILE__) + "/../lib"
|
8
8
|
require_local "shared/test_helper"
|
9
9
|
|
10
|
-
|
10
|
+
gem 'qualitysmith_extensions', '>=0.0.3'
|
11
11
|
require 'qualitysmith_extensions/test/assert_exception.rb'
|
12
12
|
require 'qualitysmith_extensions/kernel/capture_output.rb'
|
13
13
|
require 'qualitysmith_extensions/kernel/simulate_input.rb'
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.
|
2
|
+
rubygems_version: 0.9.2
|
3
3
|
specification_version: 1
|
4
4
|
name: svn-command
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-03-
|
6
|
+
version: 0.0.10
|
7
|
+
date: 2007-03-30 00:00:00 -07:00
|
8
8
|
summary: A nifty wrapper command for Subversion's command-line svn client
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -25,12 +25,12 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
25
25
|
platform: ruby
|
26
26
|
signing_key:
|
27
27
|
cert_chain:
|
28
|
+
post_install_message:
|
28
29
|
authors:
|
29
30
|
- Tyler Rick
|
30
31
|
files:
|
31
32
|
- lib/svn_command.rb
|
32
33
|
- lib/subversion.rb
|
33
|
-
- lib/attribute_accessors.rb
|
34
34
|
- lib/subversion_extensions.rb
|
35
35
|
- test/test_helper.rb
|
36
36
|
- test/subversion_extensions_test.rb
|
data/lib/attribute_accessors.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
# Extends the module object with module and instance accessors for class attributes,
|
2
|
-
# just like the native attr* accessors for instance attributes.
|
3
|
-
class Module # :nodoc:
|
4
|
-
def mattr_reader(*syms)
|
5
|
-
syms.each do |sym|
|
6
|
-
class_eval(<<-EOS, __FILE__, __LINE__)
|
7
|
-
unless defined? @@#{sym}
|
8
|
-
@@#{sym} = nil
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.#{sym}
|
12
|
-
@@#{sym}
|
13
|
-
end
|
14
|
-
|
15
|
-
def #{sym}
|
16
|
-
@@#{sym}
|
17
|
-
end
|
18
|
-
EOS
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def mattr_writer(*syms)
|
23
|
-
syms.each do |sym|
|
24
|
-
class_eval(<<-EOS, __FILE__, __LINE__)
|
25
|
-
unless defined? @@#{sym}
|
26
|
-
@@#{sym} = nil
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.#{sym}=(obj)
|
30
|
-
@@#{sym} = obj
|
31
|
-
end
|
32
|
-
|
33
|
-
def #{sym}=(obj)
|
34
|
-
@@#{sym} = obj
|
35
|
-
end
|
36
|
-
EOS
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def mattr_accessor(*syms)
|
41
|
-
mattr_reader(*syms)
|
42
|
-
mattr_writer(*syms)
|
43
|
-
end
|
44
|
-
end
|