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
data/lib/svnx/log/exec.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'system/command/line'
|
5
|
-
require 'system/command/caching'
|
6
|
-
require 'svnx/base/command'
|
7
|
-
require 'logue/loggable'
|
8
|
-
require 'svnx/log/args'
|
9
|
-
require 'svnx/log/entries'
|
10
|
-
require 'svnx/log/line'
|
11
|
-
|
12
|
-
module SvnLog
|
13
|
-
class Exec
|
14
|
-
attr_reader :entries
|
15
|
-
|
16
|
-
def initialize args
|
17
|
-
cmd = SVNx::LogCommand.new Args.new(args)
|
18
|
-
entcls = args[:entries_class] || SVNx::Log::Entries
|
19
|
-
@entries = entcls.new :xmllines => cmd.execute
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
module SVNx
|
25
|
-
class LogExec < SvnLog::Exec
|
26
|
-
end
|
27
|
-
end
|
data/lib/svnx/log/line.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'system/command/line'
|
5
|
-
require 'system/command/caching'
|
6
|
-
require 'svnx/base/command'
|
7
|
-
require 'svnx/log/args'
|
8
|
-
|
9
|
-
module SvnLog
|
10
|
-
module LogCmdLine
|
11
|
-
# this can be either an Array (for which to_a returns itself), or
|
12
|
-
# a CommandArgs, which also has to_a.
|
13
|
-
def initialize args = Array.new
|
14
|
-
super "log", args.to_a
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class LogCommandLine < SVNx::CommandLine
|
19
|
-
include LogCmdLine
|
20
|
-
end
|
21
|
-
|
22
|
-
class LogCommandLineCaching < SVNx::CachingCommandLine
|
23
|
-
include LogCmdLine
|
24
|
-
end
|
25
|
-
|
26
|
-
class CommandLine < SVNx::Command
|
27
|
-
def initialize args
|
28
|
-
@use_cache = args.use_cache
|
29
|
-
super
|
30
|
-
end
|
31
|
-
|
32
|
-
def command_line
|
33
|
-
cls = @use_cache ? LogCommandLineCaching : LogCommandLine
|
34
|
-
cls.new @args
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
module SVNx
|
40
|
-
class LogCommand < SvnLog::CommandLine
|
41
|
-
end
|
42
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'integration/tc'
|
5
|
-
require 'svnx/info/command'
|
6
|
-
require 'svnx/info/entry'
|
7
|
-
|
8
|
-
module SVNx::Info
|
9
|
-
class CommandTestCase < SVNx::IntegrationTestCase
|
10
|
-
def test_specified_args
|
11
|
-
entry = SVNx::InfoExec.new(path: '/Programs/pvn/pvntestbed.from', revision: nil, limit: nil, verbose: true, use_cache: false).entry
|
12
|
-
|
13
|
-
assert_not_nil entry
|
14
|
-
assert_equal 'dir', entry.kind
|
15
|
-
assert_equal '/Programs/pvn/pvntestbed.from', entry.path
|
16
|
-
assert_equal '22', entry.revision
|
17
|
-
assert_equal 'file:///Programs/Subversion/Repositories/pvntestbed.from', entry.root
|
18
|
-
assert_equal 'file:///Programs/Subversion/Repositories/pvntestbed.from', entry.url
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'integration/tc'
|
5
|
-
require 'svnx/log/command'
|
6
|
-
require 'svnx/log/entries'
|
7
|
-
|
8
|
-
module SVNx::Log
|
9
|
-
class CommandTestCase < SVNx::IntegrationTestCase
|
10
|
-
def assert_entry exp_revision, exp_author, exp_npaths, entries, idx
|
11
|
-
assert_equal exp_revision, entries[idx].revision
|
12
|
-
assert_equal exp_author, entries[idx].author
|
13
|
-
assert_equal exp_npaths, entries[idx].paths.size
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_specified_args
|
17
|
-
entries = SVNx::LogExec.new(path: '/Programs/pvn/pvntestbed.from', revision: nil, limit: nil, verbose: true, use_cache: false).entries
|
18
|
-
|
19
|
-
assert_equal 22, entries.size
|
20
|
-
|
21
|
-
assert_entry '21', 'Governor William J. Le Petomane', 3, entries, 1
|
22
|
-
assert_entry '1', 'Gabby Johnson', 1, entries, 21
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_default_args
|
26
|
-
entries = SVNx::LogExec.new(path: '/Programs/pvn/pvntestbed.from').entries
|
27
|
-
|
28
|
-
assert_equal 22, entries.size
|
29
|
-
|
30
|
-
assert_entry '21', 'Governor William J. Le Petomane', 0, entries, 1
|
31
|
-
assert_entry '1', 'Gabby Johnson', 0, entries, 21
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_non_verbose
|
35
|
-
entries = SVNx::LogExec.new(path: '/Programs/pvn/pvntestbed.from', verbose: false).entries
|
36
|
-
|
37
|
-
assert_equal 22, entries.size
|
38
|
-
|
39
|
-
assert_entry '21', 'Governor William J. Le Petomane', 0, entries, 1
|
40
|
-
assert_entry '1', 'Gabby Johnson', 0, entries, 21
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_revision
|
44
|
-
entries = SVNx::LogExec.new(path: '/Programs/pvn/pvntestbed.from', revision: '1:15').entries
|
45
|
-
|
46
|
-
assert_equal 15, entries.size
|
47
|
-
|
48
|
-
assert_entry '2', 'Harriet Johnson', 0, entries, 1
|
49
|
-
assert_entry '15','Mongo', 0, entries, 14
|
50
|
-
end
|
51
|
-
|
52
|
-
def test_limit
|
53
|
-
entries = SVNx::LogExec.new(path: '/Programs/pvn/pvntestbed.from', limit: 5).entries
|
54
|
-
|
55
|
-
assert_equal 5, entries.size
|
56
|
-
|
57
|
-
assert_entry '22', 'Lyle', 0, entries, 0
|
58
|
-
assert_entry '18', 'Lili von Shtupp', 0, entries, 4
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_default_entries_class
|
62
|
-
logexec = SVNx::LogExec.new(path: '/Programs/pvn/pvntestbed.from', revision: nil, limit: nil, verbose: true, use_cache: false)
|
63
|
-
assert_instance_of SVNx::Log::Entries, logexec.entries
|
64
|
-
end
|
65
|
-
|
66
|
-
class LogTestEntries < SVNx::Log::Entries
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_specified_entries_class
|
70
|
-
logexec = SVNx::LogExec.new(path: '/Programs/pvn/pvntestbed.from', revision: nil, limit: nil, verbose: true, use_cache: false, entries_class: LogTestEntries)
|
71
|
-
assert_instance_of LogTestEntries, logexec.entries
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'integration/tc'
|
5
|
-
require 'svnx/status/command'
|
6
|
-
require 'svnx/status/entries'
|
7
|
-
|
8
|
-
module SVNx::Status
|
9
|
-
class CommandTestCase < SVNx::IntegrationTestCase
|
10
|
-
def assert_entry exp_cmt_rev, exp_path, exp_status, exp_st_rev, entries, idx
|
11
|
-
entry = entries[idx]
|
12
|
-
msg = "entry[#{idx}]: #{entry.path}"
|
13
|
-
|
14
|
-
assert_equal exp_path, entry.path, msg
|
15
|
-
assert_equal exp_cmt_rev, entry.commit_revision, msg
|
16
|
-
assert_equal exp_status.to_s, entry.status.to_s, msg
|
17
|
-
assert_equal exp_st_rev, entry.status_revision, msg
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_specified_args
|
21
|
-
entries = SVNx::StatusExec.new(path: '/Programs/pvn/pvntestbed.pending', use_cache: false).entries
|
22
|
-
|
23
|
-
assert_not_nil entries
|
24
|
-
assert_equal 5, entries.size
|
25
|
-
|
26
|
-
sentries = entries.sort { |a, b| a.path <=> b.path }
|
27
|
-
|
28
|
-
assert_entry '13', '/Programs/pvn/pvntestbed.pending/FirstFile.txt', 'modified', '22', sentries, 0
|
29
|
-
assert_entry nil, '/Programs/pvn/pvntestbed.pending/SeventhFile.txt', 'added', '-1', sentries, 1
|
30
|
-
assert_entry '9', '/Programs/pvn/pvntestbed.pending/dirzero/SixthFile.txt', 'deleted', '22', sentries, 2
|
31
|
-
assert_entry nil, '/Programs/pvn/pvntestbed.pending/src/java/Charlie.java', 'unversioned', nil, sentries, 3
|
32
|
-
assert_entry nil, '/Programs/pvn/pvntestbed.pending/src/ruby/dog.rb', 'added', '-1', sentries, 4
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,235 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'integration/tc'
|
5
|
-
require 'svnx/io/element'
|
6
|
-
|
7
|
-
module SVNx::IO
|
8
|
-
class ElementTestCase < SVNx::IntegrationTestCase
|
9
|
-
PENDING_PATH = '/Programs/pvn/pvntestbed.pending'
|
10
|
-
|
11
|
-
def test_init
|
12
|
-
el = Element.new local: PENDING_PATH
|
13
|
-
assert_equal PENDING_PATH, el.local.to_path
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_exists
|
17
|
-
el = Element.new local: PENDING_PATH
|
18
|
-
assert el.exist?
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_does_not_exist
|
22
|
-
el = Element.new local: '/Programs/pvn/nosuchdirectory'
|
23
|
-
assert !el.exist?
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_is_directory
|
27
|
-
el = Element.new local: PENDING_PATH + '/text'
|
28
|
-
assert el.directory?
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_is_not_directory
|
32
|
-
el = Element.new local: PENDING_PATH + '/FirstFile.txt'
|
33
|
-
assert !el.directory?
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_is_file
|
37
|
-
el = Element.new local: PENDING_PATH + '/FirstFile.txt'
|
38
|
-
assert el.file?
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_is_not_file
|
42
|
-
el = Element.new local: PENDING_PATH + '/text'
|
43
|
-
assert !el.file?
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_get_info_has_info
|
47
|
-
el = Element.new local: PENDING_PATH + '/FirstFile.txt'
|
48
|
-
inf = el.get_info
|
49
|
-
assert_equal 'file', inf.kind
|
50
|
-
assert_equal 'FirstFile.txt', inf.path
|
51
|
-
assert_equal '22', inf.revision
|
52
|
-
assert_equal 'file:///Programs/Subversion/Repositories/pvntestbed.from', inf.root
|
53
|
-
assert_equal 'file:///Programs/Subversion/Repositories/pvntestbed.from/FirstFile.txt', inf.url
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_get_info_no_info
|
57
|
-
el = Element.new local: PENDING_PATH + '/src/java/Charlie.java'
|
58
|
-
assert_nil el.get_info
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_is_in_svn_up_to_date
|
62
|
-
el = Element.new local: PENDING_PATH + '/src/java/Alpha.java'
|
63
|
-
assert el.in_svn?
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_is_in_svn_modified
|
67
|
-
el = Element.new local: PENDING_PATH + '/FirstFile.java'
|
68
|
-
assert el.in_svn?
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_not_in_svn
|
72
|
-
el = Element.new local: PENDING_PATH + '/src/java/Charlie.java'
|
73
|
-
assert !el.in_svn?
|
74
|
-
end
|
75
|
-
|
76
|
-
def assert_status_entry idx, exp, entries
|
77
|
-
entry = entries[idx]
|
78
|
-
msg = "entry \##{idx}"
|
79
|
-
assert_equal exp[:path], entry.path, msg
|
80
|
-
assert_equal exp[:name], entry.name, msg
|
81
|
-
assert_equal exp[:status], entry.status.to_s, msg
|
82
|
-
end
|
83
|
-
|
84
|
-
def run_local_test expected, status
|
85
|
-
el = Element.new local: PENDING_PATH
|
86
|
-
entries = el.find_entries status: status
|
87
|
-
assert_equal expected.size, entries.size
|
88
|
-
expected.each_with_index do |exp, idx|
|
89
|
-
assert_status_entry idx, exp, entries
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def create_status_expected name, status
|
94
|
-
{ path: PENDING_PATH + name, name: name, status: status }
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_find_modified_local_entries
|
98
|
-
expected = Array.new
|
99
|
-
expected << create_status_expected('/FirstFile.txt', 'modified')
|
100
|
-
run_local_test expected, :modified
|
101
|
-
end
|
102
|
-
|
103
|
-
def test_find_added_local_entries
|
104
|
-
expected = Array.new
|
105
|
-
expected << create_status_expected('/SeventhFile.txt', 'added')
|
106
|
-
expected << create_status_expected('/src/ruby/dog.rb', 'added')
|
107
|
-
run_local_test expected, :added
|
108
|
-
end
|
109
|
-
|
110
|
-
def test_find_deleted_local_entries
|
111
|
-
expected = Array.new
|
112
|
-
expected << create_status_expected('/dirzero/SixthFile.txt', 'deleted')
|
113
|
-
run_local_test expected, :deleted
|
114
|
-
end
|
115
|
-
|
116
|
-
def test_find_unversioned_local_entries
|
117
|
-
expected = Array.new
|
118
|
-
expected << create_status_expected('/src/java/Charlie.java', 'unversioned')
|
119
|
-
run_local_test expected, :unversioned
|
120
|
-
end
|
121
|
-
|
122
|
-
def assert_log_entry expname, expaction, entry
|
123
|
-
assert_equal expname, entry.name
|
124
|
-
assert_equal expaction, entry.action.to_s
|
125
|
-
end
|
126
|
-
|
127
|
-
def test_find_modified_remote_entries
|
128
|
-
el = Element.new local: PENDING_PATH
|
129
|
-
entries = el.find_entries revision: '20:22', status: :modified
|
130
|
-
assert_equal 3, entries.size
|
131
|
-
assert_log_entry '/SecondFile.txt', 'modified', entries[0]
|
132
|
-
assert_log_entry '/SecondFile.txt', 'modified', entries[1]
|
133
|
-
assert_log_entry '/src/ruby/charlie.rb', 'modified', entries[2]
|
134
|
-
end
|
135
|
-
|
136
|
-
def assert_paths_equal exppath, path
|
137
|
-
assert_equal exppath[:name], path.name
|
138
|
-
assert_equal exppath[:action], path.action.to_s
|
139
|
-
assert_equal exppath[:kind], path.kind
|
140
|
-
end
|
141
|
-
|
142
|
-
def assert_log_entries expected, entries, idx
|
143
|
-
msg = "entry \##{idx}"
|
144
|
-
assert_equal expected[idx][:author], entries[idx].author, msg
|
145
|
-
assert_equal expected[idx][:date], entries[idx].date, msg
|
146
|
-
assert_equal expected[idx][:author], entries[idx].author, msg
|
147
|
-
assert_equal expected[idx][:revision], entries[idx].revision, msg
|
148
|
-
expected[idx][:paths].each_with_index do |exppath, ix|
|
149
|
-
assert_paths_equal exppath, entries[idx].paths[ix]
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
def test_log_entries_no_revision
|
154
|
-
el = Element.new local: PENDING_PATH + '/FirstFile.txt'
|
155
|
-
# these are entries of entries
|
156
|
-
entries = el.log_entries
|
157
|
-
assert_equal 5, entries.size
|
158
|
-
|
159
|
-
expected = Array.new
|
160
|
-
expected << { author: 'Jim',
|
161
|
-
date: '2012-09-16T13:51:55.741762Z',
|
162
|
-
msg: "We're not sure. Are we...black?",
|
163
|
-
revision: '13',
|
164
|
-
paths: [
|
165
|
-
{ action: 'modified', kind: 'file', name: '/FirstFile.txt' },
|
166
|
-
{ action: 'added', kind: 'file', name: '/SecondFile.txt' }
|
167
|
-
]
|
168
|
-
}
|
169
|
-
|
170
|
-
assert_log_entries expected, entries, 0
|
171
|
-
|
172
|
-
expected << { author: 'Lyle',
|
173
|
-
date: '2012-09-15T17:30:36.869900Z',
|
174
|
-
msg: 'Send wire, main office, tell them I said "ow". Gotcha!',
|
175
|
-
revision: '5',
|
176
|
-
paths: [
|
177
|
-
{ action: 'modified', kind: 'file', name: '/FirstFile.txt' },
|
178
|
-
{ action: 'modified', kind: 'file', name: '/SecondFile.txt' }
|
179
|
-
]
|
180
|
-
}
|
181
|
-
|
182
|
-
assert_log_entries expected, entries, 1
|
183
|
-
end
|
184
|
-
|
185
|
-
def test_cat_no_revision
|
186
|
-
el = Element.new local: PENDING_PATH + '/FirstFile.txt'
|
187
|
-
|
188
|
-
expected = Array.new
|
189
|
-
expected << "this is the second line of the first file.\n"
|
190
|
-
expected << "third line here.\n"
|
191
|
-
expected << "fourth line this is.\n"
|
192
|
-
|
193
|
-
lines = el.cat
|
194
|
-
assert_equal expected, lines
|
195
|
-
end
|
196
|
-
|
197
|
-
def test_cat_valid_revision
|
198
|
-
el = Element.new local: PENDING_PATH + '/FirstFile.txt'
|
199
|
-
|
200
|
-
expected = Array.new
|
201
|
-
expected << "This is the first line of the first file in the testbed.\n"
|
202
|
-
expected << "This is the second line of the first file.\n"
|
203
|
-
|
204
|
-
lines = el.cat revision: 2
|
205
|
-
|
206
|
-
assert_equal expected, lines
|
207
|
-
end
|
208
|
-
|
209
|
-
def test_cat_invalid_revision
|
210
|
-
el = Element.new local: PENDING_PATH + '/FirstFile.txt'
|
211
|
-
assert_raises(RuntimeError) do
|
212
|
-
el.cat revision: 41
|
213
|
-
end
|
214
|
-
end
|
215
|
-
|
216
|
-
def test_to_s
|
217
|
-
el = Element.new local: PENDING_PATH + '/FirstFile.txt'
|
218
|
-
assert_equal "svn => ; local => #{PENDING_PATH}/FirstFile.txt", el.to_s
|
219
|
-
end
|
220
|
-
|
221
|
-
def assert_comparable expected, x, y
|
222
|
-
assert_equal expected, x <=> y
|
223
|
-
end
|
224
|
-
|
225
|
-
def test_comparable
|
226
|
-
a = Element.new local: PENDING_PATH + '/A.txt'
|
227
|
-
b0 = Element.new local: PENDING_PATH + '/B.txt'
|
228
|
-
b1 = Element.new local: PENDING_PATH + '/B.txt'
|
229
|
-
|
230
|
-
assert_comparable(-1, a, b0)
|
231
|
-
assert_comparable( 1, b0, a)
|
232
|
-
assert_comparable( 0, b0, b1)
|
233
|
-
end
|
234
|
-
end
|
235
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'tc'
|
5
|
-
require 'svnx/base/action'
|
6
|
-
|
7
|
-
module SVNx
|
8
|
-
class ActionTestCase < SVNx::TestCase
|
9
|
-
def assert_action_equals expadd, expdel, expmod, expunver, *vals
|
10
|
-
vals.each do |val|
|
11
|
-
action = Action.new val
|
12
|
-
msg = "value: #{val}"
|
13
|
-
assert_equal expadd, action.added?, msg
|
14
|
-
assert_equal expdel, action.deleted?, msg
|
15
|
-
assert_equal expmod, action.modified?, msg
|
16
|
-
assert_equal expunver, action.unversioned?, msg
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_added
|
21
|
-
assert_action_equals true, false, false, false, 'added', 'A'
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_deleted
|
25
|
-
assert_action_equals false, true, false, false, 'deleted', 'D'
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_modified
|
29
|
-
assert_action_equals false, false, true, false, 'modified', 'M'
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_unversioned
|
33
|
-
assert_action_equals false, false, false, true, 'unversioned', '?'
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_constants
|
37
|
-
assert_equal SVNx::Action.new('added'), SVNx::Action::ADDED
|
38
|
-
assert_equal SVNx::Action.new('deleted'), SVNx::Action::DELETED
|
39
|
-
assert_equal SVNx::Action.new('modified'), SVNx::Action::MODIFIED
|
40
|
-
assert_equal SVNx::Action.new('unversioned'), SVNx::Action::UNVERSIONED
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_invalid_type
|
44
|
-
assert_raise(RuntimeError) do
|
45
|
-
SVNx::Action.new('dummy')
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|