svnx 1.0.1 → 2.0.6
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.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.glarkrc +1 -0
- data/Features.txt +7 -0
- data/Gemfile +4 -0
- data/History.txt +4 -0
- data/LICENSE +20 -0
- data/Manifest.txt +0 -0
- data/README.md +12 -0
- data/Rakefile +12 -0
- data/lib/svnx/base/action.rb +57 -52
- data/lib/svnx/base/cmdline.rb +58 -0
- data/lib/svnx/base/command.rb +49 -41
- data/lib/svnx/base/entries.rb +46 -45
- data/lib/svnx/base/entry.rb +51 -38
- data/lib/svnx/base/env.rb +26 -0
- data/lib/svnx/base/options.rb +25 -0
- data/lib/svnx/cat/command.rb +3 -64
- data/lib/svnx/cat/options.rb +28 -0
- data/lib/svnx/commit/command.rb +9 -0
- data/lib/svnx/commit/options.rb +29 -0
- data/lib/svnx/diff/command.rb +17 -0
- data/lib/svnx/diff/elements.rb +84 -0
- data/lib/svnx/diff/options.rb +35 -0
- data/lib/svnx/diff/parser.rb +105 -0
- data/lib/svnx/info/command.rb +4 -47
- data/lib/svnx/info/entries.rb +6 -8
- data/lib/svnx/info/entry.rb +21 -23
- data/lib/svnx/info/options.rb +28 -0
- data/lib/svnx/io/directory.rb +9 -5
- data/lib/svnx/io/element.rb +93 -95
- data/lib/svnx/log/command.rb +7 -3
- data/lib/svnx/log/entries.rb +17 -14
- data/lib/svnx/log/entry.rb +61 -49
- data/lib/svnx/log/options.rb +31 -0
- data/lib/svnx/merge/command.rb +9 -0
- data/lib/svnx/merge/options.rb +34 -0
- data/lib/svnx/project.rb +74 -0
- data/lib/svnx/propget/command.rb +9 -0
- data/lib/svnx/propget/entries.rb +15 -0
- data/lib/svnx/propget/entry.rb +23 -0
- data/lib/svnx/propget/options.rb +31 -0
- data/lib/svnx/propset/command.rb +9 -0
- data/lib/svnx/propset/options.rb +33 -0
- data/lib/svnx/revision/argfactory.rb +2 -2
- data/lib/svnx/revision/argument.rb +7 -3
- data/lib/svnx/revision/date.rb +27 -0
- data/lib/svnx/revision/error.rb +2 -2
- data/lib/svnx/revision/range.rb +5 -2
- data/lib/svnx/status/command.rb +4 -42
- data/lib/svnx/status/entries.rb +11 -12
- data/lib/svnx/status/entry.rb +43 -41
- data/lib/svnx/status/options.rb +28 -0
- data/lib/svnx/update/command.rb +9 -0
- data/lib/svnx/update/options.rb +25 -0
- data/lib/svnx/util/dateutil.rb +35 -0
- data/lib/svnx/util/objutil.rb +14 -0
- data/lib/{svnx.rb → svnx/version.rb} +2 -2
- data/lib/system/command/arg.rb +6 -5
- data/lib/system/command/cachefile.rb +29 -21
- data/lib/system/command/caching.rb +12 -25
- data/lib/system/command/line.rb +41 -30
- data/svnx.gemspec +34 -0
- metadata +85 -61
- data/lib/svnx/base/args.rb +0 -24
- data/lib/svnx/log/args.rb +0 -57
- data/lib/svnx/log/exec.rb +0 -27
- data/lib/svnx/log/line.rb +0 -42
- data/test/integration/info/info_test.rb +0 -21
- data/test/integration/log/log_test.rb +0 -74
- data/test/integration/status/status_test.rb +0 -35
- data/test/integration/svnx/io/element_test.rb +0 -235
- data/test/unit/svnx/base/action_test.rb +0 -49
- data/test/unit/svnx/cat/command_test.rb +0 -55
- data/test/unit/svnx/info/entries_test.rb +0 -22
- data/test/unit/svnx/log/args_test.rb +0 -15
- data/test/unit/svnx/log/entries_test.rb +0 -87
- data/test/unit/svnx/log/entry_test.rb +0 -15
- data/test/unit/svnx/log/exec_test.rb +0 -15
- data/test/unit/svnx/log/line_test.rb +0 -14
- data/test/unit/svnx/revision/argfactory_test.rb +0 -50
- data/test/unit/svnx/revision/argument_test.rb +0 -167
- data/test/unit/svnx/revision/range_test.rb +0 -48
- data/test/unit/svnx/status/entries_test.rb +0 -20
- data/test/unit/system/command/cachefile_test.rb +0 -52
- data/test/unit/system/command/caching_test.rb +0 -92
- data/test/unit/system/command/line_test.rb +0 -63
@@ -1,55 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'tc'
|
5
|
-
require 'svnx/cat/command'
|
6
|
-
|
7
|
-
module SVNx::Cat
|
8
|
-
class CommandTestCase < SVNx::TestCase
|
9
|
-
EXPROOT = 'file:///Programs/Subversion/Repositories/pvntestbed.from'
|
10
|
-
|
11
|
-
def test_cat_default
|
12
|
-
expected = Array.new
|
13
|
-
expected << 'line one of file two.'
|
14
|
-
expected << 'second line'
|
15
|
-
expected << 'third line'
|
16
|
-
expected << 'line four'
|
17
|
-
expected << 'line five'
|
18
|
-
expected << 'line 6, Six, VI'
|
19
|
-
expected << 'line 7'
|
20
|
-
expected.collect! { |x| x + "\n" }
|
21
|
-
|
22
|
-
cmd = SVNx::CatExec.new path: EXPROOT + "/SecondFile.txt"
|
23
|
-
|
24
|
-
assert_equal expected, cmd.output
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_cat_revision
|
28
|
-
expected = Array.new
|
29
|
-
expected << 'line one of file two.'
|
30
|
-
expected << 'line four'
|
31
|
-
expected << 'line five'
|
32
|
-
expected << 'line 6, Six, VI'
|
33
|
-
expected << 'line 7'
|
34
|
-
expected.collect! { |x| x + "\n" }
|
35
|
-
|
36
|
-
cmd = SVNx::CatExec.new path: EXPROOT + "/SecondFile.txt", revision: '20'
|
37
|
-
|
38
|
-
assert_equal expected, cmd.output
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_cat_out_of_range
|
42
|
-
expected = Array.new
|
43
|
-
expected << 'line one of file two.'
|
44
|
-
expected << 'line four'
|
45
|
-
expected << 'line five'
|
46
|
-
expected << 'line 6, Six, VI'
|
47
|
-
expected << 'line 7'
|
48
|
-
expected.collect! { |x| x + "\n" }
|
49
|
-
|
50
|
-
assert_raises(RuntimeError) do
|
51
|
-
SVNx::CatExec.new path: EXPROOT + "/SecondFile.txt", revision: '28'
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'svnx/info/tc'
|
5
|
-
require 'svnx/info/entries'
|
6
|
-
|
7
|
-
module SVNx::Info
|
8
|
-
class EntriesTestCase < SVNx::Info::TestCase
|
9
|
-
def assert_info_entry_equals entry, path, kind, revision
|
10
|
-
assert_entry_equals entry, :path => path, :kind => 'file', :url => EXPROOT + '/' + path, :root => EXPROOT, :revision => revision
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_create_from_xml
|
14
|
-
entries = Entries.new :xmllines => Resources::PTP_INFO_SIXTH_TXT_DOG_RB_FIRST_TXT.readlines
|
15
|
-
assert_equal 3, entries.size
|
16
|
-
|
17
|
-
assert_info_entry_equals entries[0], 'dirzero/SixthFile.txt', 'file', '22'
|
18
|
-
assert_info_entry_equals entries[1], 'src/ruby/dog.rb', 'file', '0'
|
19
|
-
assert_info_entry_equals entries[2], 'FirstFile.txt', 'file', '22'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'minitest/autorun'
|
5
|
-
require 'pathname'
|
6
|
-
require 'svnx/log/args'
|
7
|
-
|
8
|
-
class ArgsTest < Minitest::Test
|
9
|
-
def test_equivalent_api
|
10
|
-
a = SvnLog::Args.new limit: 1
|
11
|
-
b = SVNx::LogCmdLine::LogCommandArgs.new limit: 1
|
12
|
-
|
13
|
-
assert_equal b.limit, a.limit
|
14
|
-
end
|
15
|
-
end
|
@@ -1,87 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'svnx/log/tc'
|
5
|
-
require 'svnx/log/entries'
|
6
|
-
|
7
|
-
module SVNx::Log
|
8
|
-
class EntriesTestCase < SVNx::Log::TestCase
|
9
|
-
def assert_entry_fields_not_nil entry
|
10
|
-
# these are occasionally missing or blank, which REXML considers nil:
|
11
|
-
assert entry.message
|
12
|
-
assert entry.author
|
13
|
-
end
|
14
|
-
|
15
|
-
def assert_log_entry_16 entry
|
16
|
-
expdata = '16', 'Buddy Bizarre', '2012-09-16T14:07:30.329525Z', 'CUT! What in the hell do you think you\'re doing here? This is a closed set.'
|
17
|
-
expdata << { :kind => 'dir',
|
18
|
-
:action => 'A',
|
19
|
-
:name => '/src/java'
|
20
|
-
}
|
21
|
-
expdata << { :kind => 'file',
|
22
|
-
:action => 'A',
|
23
|
-
:name => '/src/java/Alpha.java'
|
24
|
-
}
|
25
|
-
expdata << { :kind => 'file',
|
26
|
-
:action => 'A',
|
27
|
-
:name => '/src/java/Bravo.java'
|
28
|
-
}
|
29
|
-
|
30
|
-
assert_log_entry_equals entry, expdata
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_create_from_xml
|
34
|
-
# entries = Entries.new :xmllines => Resources::PT_LOG_L_15.readlines this
|
35
|
-
# is the equivalent of being at revision 19 (when this was written) and
|
36
|
-
# doing "svn log -r19:5"
|
37
|
-
entries = Entries.new :xmllines => Resources::PT_LOG_R19_5.readlines
|
38
|
-
assert_log_entry_16 entries[3]
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_empty_message_element
|
42
|
-
entries = Entries.new :xmllines => Resources::PT_LOG_R19.readlines
|
43
|
-
|
44
|
-
# empty message here:
|
45
|
-
assert_entry_fields_not_nil entries[0]
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_create_on_demand
|
49
|
-
# although entries now supports xmllines as an Array, we need the size for the assertion:
|
50
|
-
xmllines = Resources::PT_LOG_R19_5.readlines
|
51
|
-
|
52
|
-
assert_equal 101, xmllines.size
|
53
|
-
|
54
|
-
entries = Entries.new :xmllines => xmllines
|
55
|
-
|
56
|
-
nentries = entries.size
|
57
|
-
assert_equal 15, nentries
|
58
|
-
|
59
|
-
# the power of Ruby, effortlessly getting instance variables ...
|
60
|
-
|
61
|
-
real_entries = entries.instance_eval '@entries'
|
62
|
-
|
63
|
-
# nothing processed yet ...
|
64
|
-
assert_nil real_entries[12]
|
65
|
-
assert_nil real_entries[13]
|
66
|
-
assert_nil real_entries[14]
|
67
|
-
|
68
|
-
assert_entry_fields_not_nil entries[13]
|
69
|
-
|
70
|
-
# and these still aren't processed:
|
71
|
-
assert_nil real_entries[12]
|
72
|
-
assert_nil real_entries[14]
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_each
|
76
|
-
idx = 0
|
77
|
-
|
78
|
-
entries = Entries.new :xmllines => Resources::PT_LOG_R19_5.readlines
|
79
|
-
entries.each do |entry|
|
80
|
-
if idx == 3
|
81
|
-
assert_log_entry_16 entry
|
82
|
-
end
|
83
|
-
idx += 1
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'svnx/log/tc'
|
5
|
-
require 'svnx/log/entry'
|
6
|
-
|
7
|
-
module SVNx::Log
|
8
|
-
class EntryTestCase < SVNx::Log::TestCase
|
9
|
-
def test_entry_from_xml
|
10
|
-
doc = REXML::Document.new Resources::PT_LOG_R19_5.readlines.join('')
|
11
|
-
entry = Entry.new :xmlelement => doc.elements[1].elements[4]
|
12
|
-
assert_log_entry_16 entry
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'minitest/autorun'
|
5
|
-
require 'pathname'
|
6
|
-
require 'svnx/log/tc'
|
7
|
-
require 'svnx/log/exec'
|
8
|
-
|
9
|
-
class ExecTest < Minitest::Test
|
10
|
-
def test_equivalent_api
|
11
|
-
a = SvnLog::Exec
|
12
|
-
b = SVNx::LogExec
|
13
|
-
assert_equal b.superclass, a
|
14
|
-
end
|
15
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'minitest/autorun'
|
5
|
-
require 'pathname'
|
6
|
-
require 'svnx/log/line'
|
7
|
-
|
8
|
-
class LineTest < Minitest::Test
|
9
|
-
def test_equivalent_api
|
10
|
-
a = SvnLog::CommandLine
|
11
|
-
b = SVNx::LogCommand
|
12
|
-
assert_equal b.superclass, a
|
13
|
-
end
|
14
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'tc'
|
5
|
-
require 'svnx/log/entries'
|
6
|
-
require 'svnx/revision/argument'
|
7
|
-
require 'resources'
|
8
|
-
|
9
|
-
module SVNx::Revision
|
10
|
-
class ArgumentFactoryTestCase < SVNx::TestCase
|
11
|
-
def setup
|
12
|
-
xmllines = Resources::PT_LOG_R22_13_SECONDFILE_TXT.readlines
|
13
|
-
@entries = SVNx::Log::Entries.new :xmllines => xmllines
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_create
|
17
|
-
arg = ArgumentFactory.new.create 14, entries: @entries
|
18
|
-
assert_not_nil arg
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_index_argument
|
22
|
-
arg = ArgumentFactory.new.create 14, entries: @entries
|
23
|
-
assert_kind_of IndexArgument, arg
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_string_svn_words
|
27
|
-
%w{ HEAD BASE COMMITTED PREV }.each do |word|
|
28
|
-
arg = ArgumentFactory.new.create word, entries: @entries
|
29
|
-
assert_kind_of StringArgument, arg
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_date
|
34
|
-
arg = ArgumentFactory.new.create '{2012-12-10}', entries: @entries
|
35
|
-
assert_kind_of StringArgument, arg
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_relative_argument_fixnum
|
39
|
-
arg = ArgumentFactory.new.create(-4, entries: @entries)
|
40
|
-
assert_kind_of IndexArgument, arg
|
41
|
-
assert_equal 15, arg.value
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_relative_argument_string
|
45
|
-
arg = ArgumentFactory.new.create('-4', entries: @entries)
|
46
|
-
assert_kind_of IndexArgument, arg
|
47
|
-
assert_equal 15, arg.value
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
@@ -1,167 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'tc'
|
5
|
-
require 'svnx/log/entries'
|
6
|
-
require 'svnx/revision/argument'
|
7
|
-
require 'resources'
|
8
|
-
|
9
|
-
module SVNx::Revision
|
10
|
-
class ArgumentTestCase < SVNx::TestCase
|
11
|
-
def setup
|
12
|
-
# This is the equivalent of "log" at revision 22, when this file was added
|
13
|
-
# at revision 13. Using this instead of just "log" when regenerating the
|
14
|
-
# resource files keeps the revisions from bouncing around.
|
15
|
-
xmllines = Resources::PT_LOG_R22_13_SECONDFILE_TXT.readlines
|
16
|
-
@entries = SVNx::Log::Entries.new :xmllines => xmllines
|
17
|
-
end
|
18
|
-
|
19
|
-
def new_argument value
|
20
|
-
Argument.new value
|
21
|
-
end
|
22
|
-
|
23
|
-
def create_argument value
|
24
|
-
Argument.create value, entries: @entries
|
25
|
-
end
|
26
|
-
|
27
|
-
def assert_argument_value exp_value, value
|
28
|
-
arg = create_argument value
|
29
|
-
assert_equal exp_value, arg.value
|
30
|
-
end
|
31
|
-
|
32
|
-
def assert_argument_value_raises value
|
33
|
-
assert_raises(SVNx::Revision::RevisionError) do
|
34
|
-
assert_argument_value nil, value
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def assert_argument_to_s exp_str, value
|
39
|
-
arg = create_argument value
|
40
|
-
assert_equal exp_str, arg.to_s
|
41
|
-
end
|
42
|
-
|
43
|
-
def assert_compare op, exp, xval, yval
|
44
|
-
x = create_argument xval
|
45
|
-
y = create_argument yval
|
46
|
-
msg = "xval: #{xval}; yval: #{yval}"
|
47
|
-
assert_equal exp, x.send(op, y), msg
|
48
|
-
end
|
49
|
-
|
50
|
-
def assert_argument_eq expeq, xval, yval
|
51
|
-
# it's the emoticon programming language
|
52
|
-
assert_compare :==, expeq, xval, yval
|
53
|
-
end
|
54
|
-
|
55
|
-
def assert_argument_gt expeq, xval, yval
|
56
|
-
assert_compare :>, expeq, xval, yval
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_new_and_create_same
|
60
|
-
x = new_argument 13
|
61
|
-
y = create_argument 13
|
62
|
-
assert_equal y.value, x.value
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_absolute_midrange
|
66
|
-
assert_argument_value 19, 19
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_absolute_most_recent
|
70
|
-
assert_argument_value 22, 22
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_absolute_least_recent
|
74
|
-
assert_argument_value 13, 13
|
75
|
-
end
|
76
|
-
|
77
|
-
def test_absolute_midrange_as_string
|
78
|
-
assert_argument_value 19, '19'
|
79
|
-
end
|
80
|
-
|
81
|
-
def test_absolute_most_recent_as_string
|
82
|
-
assert_argument_value 22, '22'
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_absolute_least_recent_as_string
|
86
|
-
assert_argument_value 13, '13'
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_svn_word
|
90
|
-
%w{ HEAD BASE COMMITTED PREV }.each do |word|
|
91
|
-
assert_argument_value word, word
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
def test_negative_most_recent
|
96
|
-
assert_argument_value 22, -1
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_negative_second_most_recent
|
100
|
-
assert_argument_value 20, -2
|
101
|
-
end
|
102
|
-
|
103
|
-
def test_negative_least_recent
|
104
|
-
assert_argument_value 13, -5
|
105
|
-
end
|
106
|
-
|
107
|
-
def test_negative_too_far_back
|
108
|
-
assert_argument_value_raises(-6)
|
109
|
-
end
|
110
|
-
|
111
|
-
def test_negative_most_recent_as_string
|
112
|
-
assert_argument_value 22, '-1'
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_negative_second_most_recent_as_string
|
116
|
-
assert_argument_value 20, '-2'
|
117
|
-
end
|
118
|
-
|
119
|
-
def test_negative_least_recent_as_string
|
120
|
-
assert_argument_value 13, '-5'
|
121
|
-
end
|
122
|
-
|
123
|
-
def test_negative_too_far_back_as_string
|
124
|
-
assert_argument_value_raises '-6'
|
125
|
-
end
|
126
|
-
|
127
|
-
def test_positive_most_recent
|
128
|
-
assert_argument_value 22, '+5'
|
129
|
-
end
|
130
|
-
|
131
|
-
def test_positive_second_most_recent
|
132
|
-
assert_argument_value 20, '+4'
|
133
|
-
end
|
134
|
-
|
135
|
-
def test_positive_least_recent
|
136
|
-
assert_argument_value 13, '+1'
|
137
|
-
end
|
138
|
-
|
139
|
-
def test_positive_too_far_forward
|
140
|
-
assert_argument_value_raises '+6'
|
141
|
-
end
|
142
|
-
|
143
|
-
def xxxtest_range_svn_word_to_number
|
144
|
-
assert_argument_value 'BASE:1', 'BASE:1'
|
145
|
-
end
|
146
|
-
|
147
|
-
def xxxtest_date
|
148
|
-
assert_argument_to_s '1967-12-10', '1967-12-10'
|
149
|
-
end
|
150
|
-
|
151
|
-
def test_to_s
|
152
|
-
assert_argument_to_s '5', '5'
|
153
|
-
assert_argument_to_s 'HEAD', 'HEAD'
|
154
|
-
end
|
155
|
-
|
156
|
-
def test_eq
|
157
|
-
assert_argument_eq true, '5', '5'
|
158
|
-
assert_argument_eq false, '4', '5'
|
159
|
-
assert_argument_eq false, '5', '4'
|
160
|
-
end
|
161
|
-
|
162
|
-
def test_gt
|
163
|
-
assert_argument_gt true, '17', '16'
|
164
|
-
assert_argument_gt false, '13', '14'
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|