vcs 0.2.148 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +6 -0
- data/NEWS +9 -0
- data/README +82 -0
- data/Rakefile +7 -72
- data/SPEC.dyn.yml +10 -0
- data/SPEC.gemspec +14 -0
- data/SPEC.yml +39 -0
- data/bin/vcs +18 -16
- data/lib/vcs/changelog.rb +164 -0
- data/lib/vcs/conflict.rb +21 -0
- data/{src → lib/vcs}/cvs.rb +1 -1
- data/{src → lib/vcs}/diff.rb +2 -2
- data/lib/vcs/diffstat.rb +28 -0
- data/lib/vcs/edit.rb +16 -0
- data/{src → lib/vcs}/last_changed_date.rb +3 -5
- data/{src → lib/vcs}/mail.rb +4 -4
- data/lib/vcs/message.rb +79 -0
- data/{src → lib/vcs}/mycommit.rb +15 -15
- data/{src → lib/vcs}/news.rb +6 -6
- data/{src → lib/vcs}/prcs.rb +1 -1
- data/{src → lib/vcs}/revision.rb +3 -4
- data/lib/vcs/script.rb +19 -0
- data/{src → lib/vcs}/status.rb +1 -1
- data/{src → lib/vcs}/svn.rb +3 -5
- data/lib/vcs/url.rb +16 -0
- data/lib/vcs/vcs.rb +279 -0
- metadata +52 -150
- data/TODO +0 -19
- data/doc/jamis.rb +0 -564
- data/ruby_ex/abstract.rb +0 -254
- data/ruby_ex/abstract_node.rb +0 -85
- data/ruby_ex/algorithms/simulated_annealing.rb +0 -140
- data/ruby_ex/array_each_pair.rb +0 -18
- data/ruby_ex/ask.rb +0 -101
- data/ruby_ex/attributed_class.rb +0 -302
- data/ruby_ex/cache.rb +0 -373
- data/ruby_ex/checkout.rb +0 -12
- data/ruby_ex/choose.rb +0 -271
- data/ruby_ex/commands.rb +0 -18
- data/ruby_ex/commands/command.rb +0 -401
- data/ruby_ex/commands/datas.rb +0 -16
- data/ruby_ex/commands/datas/data.rb +0 -33
- data/ruby_ex/commands/datas/factory.rb +0 -66
- data/ruby_ex/commands/factory.rb +0 -66
- data/ruby_ex/commands/helpers.rb +0 -67
- data/ruby_ex/commands/pipe.rb +0 -64
- data/ruby_ex/commands/runners.rb +0 -17
- data/ruby_ex/commands/runners/exec.rb +0 -49
- data/ruby_ex/commands/runners/fork.rb +0 -97
- data/ruby_ex/commands/runners/runner.rb +0 -107
- data/ruby_ex/commands/seq.rb +0 -27
- data/ruby_ex/config_file.rb +0 -96
- data/ruby_ex/const_regexp.rb +0 -59
- data/ruby_ex/daemon.rb +0 -134
- data/ruby_ex/diff.rb +0 -667
- data/ruby_ex/dlogger.rb +0 -62
- data/ruby_ex/drb/dispatcher.rb +0 -252
- data/ruby_ex/drb/dispatcher_server_test.rb +0 -29
- data/ruby_ex/drb/drb_observable.rb +0 -97
- data/ruby_ex/drb/drb_observable_pool.rb +0 -27
- data/ruby_ex/drb/drb_service.rb +0 -43
- data/ruby_ex/drb/drb_undumped_attributes.rb +0 -55
- data/ruby_ex/drb/drb_undumped_indexed_object.rb +0 -54
- data/ruby_ex/drb/insecure_protected_methods.rb +0 -103
- data/ruby_ex/drb/session_client_test.rb +0 -40
- data/ruby_ex/drb/session_manager.rb +0 -246
- data/ruby_ex/drb/session_server.rb +0 -53
- data/ruby_ex/dtime.rb +0 -143
- data/ruby_ex/dumpable_proc.rb +0 -63
- data/ruby_ex/exception.rb +0 -32
- data/ruby_ex/filetype.rb +0 -229
- data/ruby_ex/fileutils_ex.rb +0 -44
- data/ruby_ex/fold.rb +0 -58
- data/ruby_ex/generate_id.rb +0 -44
- data/ruby_ex/hookable.rb +0 -262
- data/ruby_ex/hooker.rb +0 -54
- data/ruby_ex/inactive_timeout.rb +0 -137
- data/ruby_ex/indexed_node.rb +0 -66
- data/ruby_ex/io_marshal.rb +0 -100
- data/ruby_ex/ioo.rb +0 -194
- data/ruby_ex/labeled_node.rb +0 -63
- data/ruby_ex/logger_observer.rb +0 -23
- data/ruby_ex/md5sum.rb +0 -66
- data/ruby_ex/mktemp.rb +0 -208
- data/ruby_ex/module/attr_once.rb +0 -36
- data/ruby_ex/module/autoload_tree.rb +0 -75
- data/ruby_ex/module/hierarchy.rb +0 -335
- data/ruby_ex/module/instance_method_visibility.rb +0 -73
- data/ruby_ex/module_ex.rb +0 -11
- data/ruby_ex/node.rb +0 -80
- data/ruby_ex/object_monitor.rb +0 -145
- data/ruby_ex/object_monitor_activity.rb +0 -33
- data/ruby_ex/observable.rb +0 -140
- data/ruby_ex/observable_pool.rb +0 -293
- data/ruby_ex/orderedhash.rb +0 -252
- data/ruby_ex/pathname_ex.rb +0 -152
- data/ruby_ex/pp_hierarchy.rb +0 -29
- data/ruby_ex/pseudo_cache.rb +0 -190
- data/ruby_ex/queue.rb +0 -56
- data/ruby_ex/random_generators.rb +0 -25
- data/ruby_ex/random_generators/random_generator.rb +0 -31
- data/ruby_ex/random_generators/ruby.rb +0 -23
- data/ruby_ex/safe_eval.rb +0 -348
- data/ruby_ex/sendmail.rb +0 -215
- data/ruby_ex/service_manager.rb +0 -121
- data/ruby_ex/session/administrable.rb +0 -120
- data/ruby_ex/session/client.rb +0 -153
- data/ruby_ex/session/const.rb +0 -18
- data/ruby_ex/session/dispatcher.rb +0 -184
- data/ruby_ex/session/error.rb +0 -21
- data/ruby_ex/session/fetchable.rb +0 -57
- data/ruby_ex/session/fetcher.rb +0 -62
- data/ruby_ex/session/hookable.rb +0 -26
- data/ruby_ex/session/profile.rb +0 -110
- data/ruby_ex/session/server.rb +0 -582
- data/ruby_ex/session/test/administrable_test.rb +0 -337
- data/ruby_ex/session/test/basic_test.rb +0 -523
- data/ruby_ex/session/test/dispatcher_test.rb +0 -409
- data/ruby_ex/session/test/fetchable_test.rb +0 -119
- data/ruby_ex/session/test/sub_server_test.rb +0 -188
- data/ruby_ex/shuffle.rb +0 -30
- data/ruby_ex/spring.rb +0 -136
- data/ruby_ex/spring_set.rb +0 -137
- data/ruby_ex/string_ex.rb +0 -28
- data/ruby_ex/symtbl.rb +0 -106
- data/ruby_ex/synflow.rb +0 -474
- data/ruby_ex/test/unit/ui/yaml/testrunner.rb +0 -164
- data/ruby_ex/thread_mutex.rb +0 -10
- data/ruby_ex/timeout_ex.rb +0 -81
- data/ruby_ex/top_down.rb +0 -73
- data/ruby_ex/trace.rb +0 -26
- data/ruby_ex/uri/druby.rb +0 -81
- data/ruby_ex/uri/file.rb +0 -65
- data/ruby_ex/uri/ftp_ex.rb +0 -37
- data/ruby_ex/uri/http_ex.rb +0 -43
- data/ruby_ex/uri/ssh.rb +0 -92
- data/ruby_ex/uri/svn.rb +0 -118
- data/ruby_ex/uri_ex.rb +0 -45
- data/ruby_ex/verbose_object.rb +0 -30
- data/ruby_ex/version.rb +0 -66
- data/ruby_ex/yaml/basenode_ext.rb +0 -63
- data/ruby_ex/yaml/chop_header.rb +0 -23
- data/ruby_ex/yaml/transform.rb +0 -449
- data/ruby_ex/yaml/yregexpath.rb +0 -76
- data/src/ask.rb +0 -101
- data/src/changelog.rb +0 -117
- data/src/conflict.rb +0 -20
- data/src/diffstat.rb +0 -42
- data/src/message.rb +0 -64
- data/src/reply-mail.rb +0 -14
- data/src/tools.rb +0 -22
- data/src/vcs.rb +0 -176
data/ruby_ex/yaml/yregexpath.rb
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
# Author:: Marco Tessari <marco.tessari@epita.fr>.
|
2
|
-
# Copyright:: Copyright (c) 2004 TTK Team. All rights reserved.
|
3
|
-
# License:: Ruby license.
|
4
|
-
|
5
|
-
# $LastChangedBy: polrop $
|
6
|
-
# $Id: yregexpath.rb 159 2005-02-18 12:07:23Z polrop $
|
7
|
-
|
8
|
-
module YAML
|
9
|
-
|
10
|
-
class YRegexPath
|
11
|
-
attr_reader :segments, :root, :wanted_node_index
|
12
|
-
|
13
|
-
def initialize ( str )
|
14
|
-
raise ArgumentError, 'Argument must be a string' unless str.is_a?(String)
|
15
|
-
@segments = []
|
16
|
-
@wanted_node_index = nil
|
17
|
-
@root = (str[0] == ?/)
|
18
|
-
while str =~ /^(\/|#)?((?:(?:\\.)|[^\\=\/#])+)(?:=((?:(?:\\.)|[^\\\/#])*))?/
|
19
|
-
if ($1 == "#")
|
20
|
-
if (@wanted_node_index.nil?)
|
21
|
-
@wanted_node_index = @segments.length
|
22
|
-
else
|
23
|
-
raise ArgumentError, 'More than a "#" given.'
|
24
|
-
end
|
25
|
-
end
|
26
|
-
if ($3.nil?)
|
27
|
-
@segments << Regexp.new($2)
|
28
|
-
else
|
29
|
-
@segments << [ Regexp.new($2), Regexp.new($3) ]
|
30
|
-
end
|
31
|
-
str = $'
|
32
|
-
end
|
33
|
-
@wanted_node_index = @segments.length if @wanted_node_index.nil?
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end # module YAML
|
38
|
-
|
39
|
-
if defined? TEST_MODE or $0 == __FILE__
|
40
|
-
|
41
|
-
require 'test/unit'
|
42
|
-
|
43
|
-
class YRegexPathTest < Test::Unit::TestCase
|
44
|
-
def compare(str, tab)
|
45
|
-
tab.collect! do |e|
|
46
|
-
if (e.is_a?(Array))
|
47
|
-
e.collect! { |s| Regexp.new(s) unless s.nil? }
|
48
|
-
else
|
49
|
-
Regexp.new(e)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
desc = "Compare #{str} with #{tab}."
|
53
|
-
assert_equal(tab, YAML::YRegexPath.new(str).segments, desc)
|
54
|
-
end
|
55
|
-
|
56
|
-
def testit
|
57
|
-
compare('mho', [ 'mho' ])
|
58
|
-
compare('mho\\', [ 'mho' ])
|
59
|
-
compare('/mho', [ 'mho' ])
|
60
|
-
compare('/mho=42', [ [ 'mho', '42'] ])
|
61
|
-
compare('/mho=[0-9]+', [ [ 'mho', '[0-9]+' ] ])
|
62
|
-
compare('m\/ho', [ 'm\/ho' ])
|
63
|
-
compare('mho/foo', [ 'mho', 'foo' ])
|
64
|
-
compare('mho=35/foo=test', [ [ 'mho' , '35' ], [ 'foo' , 'test' ] ])
|
65
|
-
compare('test#status=PASS', [ 'test' , [ 'status' , 'PASS' ] ])
|
66
|
-
compare('mho#', [ 'mho' ])
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_errors
|
70
|
-
# Build with something else than a String.
|
71
|
-
assert_raise(ArgumentError) { YAML::YRegexPath.new(42) }
|
72
|
-
# Two '#'.
|
73
|
-
assert_raise(ArgumentError) { YAML::YRegexPath.new('1#2#3') }
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
data/src/ask.rb
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
|
-
# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
|
3
|
-
# License:: GNU General Public License (GPL).
|
4
|
-
|
5
|
-
# $LastChangedBy: ertai $
|
6
|
-
# $Id: header 98 2004-09-29 12:07:43Z ertai $
|
7
|
-
|
8
|
-
ANSWERS = [ :y, :n ]
|
9
|
-
ANSWER_NOT_VALID = 'Not a valid answer, please answer correctly'
|
10
|
-
|
11
|
-
# `ask', ask the user to answer, to your question.
|
12
|
-
#
|
13
|
-
# Example:
|
14
|
-
# ask('Commiting, are you sure', :n)
|
15
|
-
#
|
16
|
-
# produce => Commiting, are you sure (y/N):
|
17
|
-
# and wait your answer.
|
18
|
-
def ask ( aQuestion, theDefaultAnswer=:y, cin=STDIN, cout=STDOUT, cerr=STDERR )
|
19
|
-
|
20
|
-
yn = case theDefaultAnswer
|
21
|
-
when :y then ' [Y/n]: '
|
22
|
-
when :n then ' [y/N]: '
|
23
|
-
else raise ArgumentError, "not valid default answer #{theDefaultAnswer}"
|
24
|
-
end
|
25
|
-
|
26
|
-
loop do
|
27
|
-
cout.print aQuestion, yn
|
28
|
-
cout.flush
|
29
|
-
|
30
|
-
answer = cin.readline.chomp.downcase
|
31
|
-
|
32
|
-
return theDefaultAnswer if answer.empty?
|
33
|
-
|
34
|
-
answer = answer.to_sym
|
35
|
-
|
36
|
-
return answer if ANSWERS.include? answer
|
37
|
-
|
38
|
-
cerr.puts ANSWER_NOT_VALID
|
39
|
-
cout.puts
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
if defined? TEST_MODE or $0 == __FILE__
|
45
|
-
|
46
|
-
require 'test/unit'
|
47
|
-
class AskTest < Test::Unit::TestCase
|
48
|
-
|
49
|
-
def ask_checker ( question, default, answer, ref, out, err )
|
50
|
-
require 'stringio'
|
51
|
-
cin, cout, cerr = StringIO.new, StringIO.new, StringIO.new
|
52
|
-
cin.puts answer
|
53
|
-
cin.rewind
|
54
|
-
res = ask(question, default, cin, cout, cerr)
|
55
|
-
cout.rewind
|
56
|
-
cerr.rewind
|
57
|
-
assert_equal(res, ref, 'bad return value')
|
58
|
-
assert_equal(cout.readlines.join, out, 'bad standard output')
|
59
|
-
assert_equal(cerr.readlines.join, err, 'bad error output')
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_bad_default
|
63
|
-
assert_raise(ArgumentError) { ask_checker('Q', :foo, '', :y, [], []) }
|
64
|
-
assert_nothing_raised do
|
65
|
-
ask_checker('Q', :y, 'y', :y, 'Q [Y/n]: ', '')
|
66
|
-
end
|
67
|
-
assert_nothing_raised do
|
68
|
-
ask_checker('Q', :n, 'y', :y, 'Q [y/N]: ', '')
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_valid_default_yes
|
73
|
-
ask_checker('Q', :y, 'y', :y, 'Q [Y/n]: ', '')
|
74
|
-
ask_checker('Q', :y, 'Y', :y, 'Q [Y/n]: ', '')
|
75
|
-
ask_checker('Q', :y, 'n', :n, 'Q [Y/n]: ', '')
|
76
|
-
ask_checker('Q', :y, 'N', :n, 'Q [Y/n]: ', '')
|
77
|
-
ask_checker('Q', :y, '', :y, 'Q [Y/n]: ', '')
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_valid_default_no
|
81
|
-
ask_checker('Q', :n, 'y', :y, 'Q [y/N]: ', '')
|
82
|
-
ask_checker('Q', :n, 'Y', :y, 'Q [y/N]: ', '')
|
83
|
-
ask_checker('Q', :n, 'n', :n, 'Q [y/N]: ', '')
|
84
|
-
ask_checker('Q', :n, 'N', :n, 'Q [y/N]: ', '')
|
85
|
-
ask_checker('Q', :n, '', :n, 'Q [y/N]: ', '')
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_invalid_answer
|
89
|
-
ask_checker('Q', :n, "bad\ny", :y,
|
90
|
-
"Q [y/N]: \nQ [y/N]: ", ANSWER_NOT_VALID + "\n")
|
91
|
-
ask_checker('Q', :y, "ad\n\n", :y,
|
92
|
-
"Q [Y/n]: \nQ [Y/n]: ", ANSWER_NOT_VALID + "\n")
|
93
|
-
end
|
94
|
-
|
95
|
-
def test_ask1
|
96
|
-
ask_checker('Q', :y, 'y', :y, 'Q [Y/n]: ', '')
|
97
|
-
end
|
98
|
-
|
99
|
-
end # class AskTest
|
100
|
-
|
101
|
-
end
|
data/src/changelog.rb
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
|
-
# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
|
3
|
-
# License:: GNU General Public License (GPL).
|
4
|
-
|
5
|
-
# $LastChangedBy: ertai $
|
6
|
-
# $Id: header 98 2004-09-29 12:07:43Z ertai $
|
7
|
-
|
8
|
-
require 'vcs'
|
9
|
-
require 'svn'
|
10
|
-
|
11
|
-
class Svn
|
12
|
-
|
13
|
-
@@file_st =
|
14
|
-
{
|
15
|
-
'A' => 'New',
|
16
|
-
'D' => 'Remove',
|
17
|
-
}
|
18
|
-
@@file_st.default = ''
|
19
|
-
|
20
|
-
@@prop_st =
|
21
|
-
{
|
22
|
-
'M' => 'Changed property'
|
23
|
-
}
|
24
|
-
|
25
|
-
def mkchangelog_from_status ( *args )
|
26
|
-
result = []
|
27
|
-
from_status(*args) do |line, file_st, prop_st, copy_st, file|
|
28
|
-
next if file_st =~ /[?X]/
|
29
|
-
next if file == 'ChangeLog'
|
30
|
-
ls = []
|
31
|
-
ls << @@file_st[file_st] if @@file_st.has_key? file_st
|
32
|
-
ls << @@prop_st[prop_st].downcase if @@prop_st.has_key? prop_st
|
33
|
-
result << [file, ls.join(', ')]
|
34
|
-
end
|
35
|
-
raise Failure, 'No changes, so no ChangeLog entry.' if result.empty?
|
36
|
-
result
|
37
|
-
end
|
38
|
-
private :mkchangelog_from_status
|
39
|
-
|
40
|
-
end # class Svn
|
41
|
-
|
42
|
-
|
43
|
-
class Vcs
|
44
|
-
|
45
|
-
class MustBeFilled < Exception
|
46
|
-
attr_reader :file
|
47
|
-
def initialize ( file )
|
48
|
-
@file = file
|
49
|
-
super("You must fill this file: `#{file.to_s}'")
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def mkchangelog ( *args )
|
54
|
-
error_handling :changelog_failed
|
55
|
-
|
56
|
-
cl = ADD_CL
|
57
|
-
|
58
|
-
if cl.exist?
|
59
|
-
f = cl.open('r')
|
60
|
-
if f.readline !~ /^===/
|
61
|
-
f.rewind
|
62
|
-
return f
|
63
|
-
end
|
64
|
-
f.close
|
65
|
-
else
|
66
|
-
cl_add = mkchangelog_from_status(*args)
|
67
|
-
LOG.warn "Creating a new `#{cl}' file"
|
68
|
-
cl.open('w') do |f|
|
69
|
-
f.puts '=== Fill this file correctly and remove this line ==='
|
70
|
-
f.puts Time.now.strftime("%Y-%m-%d #{FULL_EMAIL}")
|
71
|
-
f.puts
|
72
|
-
cl_add.each do |file, str|
|
73
|
-
f.puts "\t* #{file}: #{str}."
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
raise MustBeFilled, cl
|
79
|
-
end
|
80
|
-
|
81
|
-
def concat_changelog! ( *args )
|
82
|
-
error_handling :changelog_failed
|
83
|
-
|
84
|
-
unless CL.exist?
|
85
|
-
raise Failure, "No `#{CL}', you are probably not in a valid directory."
|
86
|
-
end
|
87
|
-
|
88
|
-
if cl = mkchangelog(*args)
|
89
|
-
|
90
|
-
unless TMP_CL.exist?
|
91
|
-
LOG.info "Moving `#{CL}' to `#{TMP_CL}' ..."
|
92
|
-
CL.rename(TMP_CL)
|
93
|
-
end
|
94
|
-
|
95
|
-
CL.open('w') do |file|
|
96
|
-
LOG.info "Prepending `#{ADD_CL}' to `#{CL}' ..."
|
97
|
-
file.print cl.read
|
98
|
-
file.puts
|
99
|
-
file.print TMP_CL.read
|
100
|
-
end
|
101
|
-
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
def changelog_failed
|
106
|
-
if TMP_CL.exist?
|
107
|
-
LOG.info "Restoring `#{CL}' from `#{TMP_CL}' ..."
|
108
|
-
TMP_CL.rename(CL)
|
109
|
-
end
|
110
|
-
LOG.info "#{ADD_CL}: Contains your ChangeLog entry" if ADD_CL.exist?
|
111
|
-
end
|
112
|
-
|
113
|
-
alias_command :mkcl, :mkchangelog
|
114
|
-
alias_command :ctcl, :concat_changelog
|
115
|
-
|
116
|
-
end # class Vcs
|
117
|
-
|
data/src/conflict.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
class Vcs
|
2
|
-
|
3
|
-
def mk_conflicts_list
|
4
|
-
status.grep(/^C/).each { |s| s.sub!(/^C\s+(.*)\n/, '\1') }
|
5
|
-
end
|
6
|
-
|
7
|
-
def edit_conflicts
|
8
|
-
system("#{EDITOR} #{mk_conflicts_list}")
|
9
|
-
end
|
10
|
-
|
11
|
-
def resolve_conflicts
|
12
|
-
conflicts = mk_conflicts_list
|
13
|
-
question = "Resolve these conflicts: \n - #{conflicts.join("\n - ")}\n"
|
14
|
-
if ask(question, :n) == :y
|
15
|
-
return resolved(conflicts)
|
16
|
-
end
|
17
|
-
[]
|
18
|
-
end
|
19
|
-
|
20
|
-
end # class Vcs
|
data/src/diffstat.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
|
-
# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
|
3
|
-
# License:: GNU General Public License (GPL).
|
4
|
-
|
5
|
-
# $LastChangedBy: ertai $
|
6
|
-
# $Id: header 98 2004-09-29 12:07:43Z ertai $
|
7
|
-
|
8
|
-
require 'vcs'
|
9
|
-
|
10
|
-
class Vcs
|
11
|
-
|
12
|
-
# Use the diffstat command to
|
13
|
-
# display statitics on your patch.
|
14
|
-
def diffstat ( *a )
|
15
|
-
check_diffstat
|
16
|
-
patch = diff(*a)
|
17
|
-
rd, wr = IO.pipe
|
18
|
-
pid = fork do
|
19
|
-
rd.close
|
20
|
-
STDIN.reopen(patch)
|
21
|
-
STDOUT.reopen(wr)
|
22
|
-
exec 'diffstat'
|
23
|
-
end
|
24
|
-
wr.close
|
25
|
-
def rd.close
|
26
|
-
super
|
27
|
-
Process.waitpid pid
|
28
|
-
end
|
29
|
-
rd
|
30
|
-
end
|
31
|
-
alias_command :ds, :diffstat
|
32
|
-
|
33
|
-
def check_diffstat
|
34
|
-
unless `diffstat -V` =~ /diffstat version/
|
35
|
-
raise ArgumentError, 'The `diffstat\' tool is needed by Vcs.diffstat'
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
add_conf_checker :check_diffstat
|
40
|
-
|
41
|
-
end # class Vcs
|
42
|
-
|
data/src/message.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
|
-
# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
|
3
|
-
# License:: GNU General Public License (GPL).
|
4
|
-
|
5
|
-
# $LastChangedBy: ertai $
|
6
|
-
# $Id: header 98 2004-09-29 12:07:43Z ertai $
|
7
|
-
|
8
|
-
require 'vcs'
|
9
|
-
require 'changelog'
|
10
|
-
|
11
|
-
class Vcs
|
12
|
-
def diffw ( *args )
|
13
|
-
diff(*args)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
class Svn
|
18
|
-
def diffw ( *args )
|
19
|
-
diff('--diff-cmd', 'diff', '-x', '-NPbuw', *args)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class Vcs
|
24
|
-
|
25
|
-
@@message = Pathname.new(',message')
|
26
|
-
|
27
|
-
def print_body ( file, options )
|
28
|
-
LOG.warn "Creating a new `#{file}' file"
|
29
|
-
file.open('w') do |f|
|
30
|
-
f.puts options.to_yaml
|
31
|
-
f.puts '---'
|
32
|
-
f.puts
|
33
|
-
f.print message.read
|
34
|
-
end
|
35
|
-
end
|
36
|
-
private :print_body
|
37
|
-
|
38
|
-
def message ( *args )
|
39
|
-
error_handling :message_failed
|
40
|
-
|
41
|
-
unless @@message.exist?
|
42
|
-
cl = mkchangelog(*args)
|
43
|
-
@@message.open('w') do |f|
|
44
|
-
f.puts 'Index: ChangeLog'
|
45
|
-
f.print cl.read.sub(/^\d+-\d+-\d+/, 'from')
|
46
|
-
f.puts
|
47
|
-
f.print diffstat(*args).read
|
48
|
-
f.puts
|
49
|
-
diffw_from_status(*args).each { |line| f.print line if line !~ /^=+$/ }
|
50
|
-
end
|
51
|
-
end
|
52
|
-
@@message.open('r')
|
53
|
-
end
|
54
|
-
|
55
|
-
alias_command :msg, :message
|
56
|
-
|
57
|
-
def message_failed
|
58
|
-
if @@message.exist?
|
59
|
-
LOG.info "#{@@message}: Contains the generated message"
|
60
|
-
LOG.info ' (the ChangeLog entry, the diffstat, the diff)'
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
end # class Vcs
|
data/src/reply-mail.rb
DELETED
data/src/tools.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
|
2
|
-
# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
|
3
|
-
# License:: GNU General Public License (GPL).
|
4
|
-
|
5
|
-
# $LastChangedBy: ertai $
|
6
|
-
# $Id: header 98 2004-09-29 12:07:43Z ertai $
|
7
|
-
|
8
|
-
require 'yaml'
|
9
|
-
module YAML
|
10
|
-
|
11
|
-
def self.chop_header ( io )
|
12
|
-
aStr = io.gets
|
13
|
-
raise Exception, "First line is not valid: `#{aLine}'" unless aStr =~ /^---/
|
14
|
-
io.each do |aLine|
|
15
|
-
break if aLine =~ /^---/
|
16
|
-
aStr += aLine
|
17
|
-
end
|
18
|
-
YAML::load(aStr)
|
19
|
-
end
|
20
|
-
|
21
|
-
end # module YAML
|
22
|
-
|