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.
- data/bin/change.rb +50 -0
- data/bin/pvn +8 -4
- data/bin/quote.rb +18 -6
- data/bin/quotes.orig.txt +145 -0
- data/bin/quotes.txt +64 -0
- data/lib/pvn/app/runner.rb +103 -0
- data/lib/pvn/app.rb +1 -142
- data/lib/pvn/{subcommands/base → command}/color_option.rb +1 -1
- data/lib/pvn/{subcommands/base → command}/command.rb +10 -6
- data/lib/pvn/{subcommands/base → command}/doc.rb +2 -2
- data/lib/pvn/{subcommands/base → command}/options.rb +2 -2
- data/lib/pvn/config.rb +14 -1
- data/lib/pvn/{subcommands/diff → diff}/command.rb +6 -6
- data/lib/pvn/diff/differ.rb +60 -44
- data/lib/pvn/diff/local_differ.rb +99 -0
- data/lib/pvn/diff/log_paths.rb +46 -0
- data/lib/pvn/{subcommands/diff → diff}/options.rb +8 -6
- data/lib/pvn/diff/path.rb +52 -0
- data/lib/pvn/diff/path_revision.rb +31 -0
- data/lib/pvn/diff/paths.rb +42 -0
- data/lib/pvn/diff/repository_differ.rb +154 -0
- data/lib/pvn/diff/revision.rb +36 -0
- data/lib/pvn/diff/status_paths.rb +87 -0
- data/lib/pvn/io/element.rb +29 -8
- data/lib/pvn/{subcommands/log → log}/command.rb +4 -4
- data/lib/pvn/log/formatter/log_formatter.rb +1 -1
- data/lib/pvn/{subcommands/log → log}/options.rb +7 -7
- data/lib/pvn/{subcommands/pct → pct}/command.rb +6 -6
- data/lib/pvn/{subcommands/pct → pct}/diffcount.rb +1 -1
- data/lib/pvn/{subcommands/pct → pct}/differ.rb +2 -2
- data/lib/pvn/{subcommands/pct → pct}/local_differ.rb +3 -3
- data/lib/pvn/pct/options.rb +12 -0
- data/lib/pvn/{subcommands/pct → pct}/repository_differ.rb +5 -13
- data/lib/pvn/revision/{entry.rb → argument.rb} +45 -30
- data/lib/pvn/{subcommands/revision → revision}/base_option.rb +2 -2
- data/lib/pvn/revision/error.rb +11 -0
- data/lib/pvn/{subcommands/revision → revision}/multiple_revisions_option.rb +1 -1
- data/lib/pvn/revision/range.rb +49 -0
- data/lib/pvn/{subcommands/revision → revision}/revision_option.rb +1 -8
- data/lib/pvn/{subcommands/revision → revision}/revision_regexp_option.rb +2 -2
- data/lib/pvn/{subcommands/status → status}/command.rb +6 -6
- data/lib/pvn/status/formatter/status_formatter.rb +1 -1
- data/lib/pvn/status/options.rb +12 -0
- data/lib/pvn/{base/util.rb → util/array.rb} +2 -1
- data/lib/pvn.rb +1 -6
- data/lib/svnx/action.rb +52 -0
- data/lib/svnx/entries.rb +9 -1
- data/lib/svnx/log/command.rb +4 -3
- data/lib/svnx/status/entry.rb +30 -13
- data/lib/synoption/base_option.rb +10 -27
- data/lib/synoption/matchers.rb +22 -0
- data/lib/system/command/cachefile.rb +28 -14
- data/lib/system/command.rb +1 -1
- data/test/integration/pvn/diff/command_test.rb +20 -0
- data/test/integration/pvn/diff/local_differ_test.rb +72 -0
- data/test/integration/pvn/diff/log_paths_test.rb +28 -0
- data/test/integration/pvn/diff/repository_differ_test.rb +127 -0
- data/test/integration/pvn/diff/status_paths_test.rb +31 -0
- data/test/integration/pvn/log/command_test.rb +29 -0
- data/test/integration/pvn/pct/command_test.rb +30 -0
- data/test/integration/pvn/status/command_test.rb +26 -0
- data/test/unit/pvn/app_test.rb +7 -5
- data/test/unit/pvn/diff/path_revision_test.rb +45 -0
- data/test/unit/pvn/diff/path_test.rb +38 -0
- data/test/unit/pvn/diff/revision_test.rb +35 -0
- data/test/unit/pvn/io/element/log/log_test.rb +2 -2
- data/test/unit/pvn/log/formatter/entry_formatter_test.rb +40 -29
- data/test/unit/pvn/{subcommands/log → log}/options_test.rb +4 -4
- data/test/unit/pvn/revision/argument_test.rb +157 -0
- data/test/unit/pvn/{subcommands/revision → revision}/multiple_revisions_option_test.rb +10 -11
- data/test/unit/pvn/revision/range_test.rb +26 -0
- data/test/unit/pvn/{subcommands/revision → revision}/revision_option_test.rb +13 -18
- data/test/unit/pvn/{subcommands/revision → revision}/revision_regexp_option_test.rb +8 -10
- data/test/unit/svnx/action_test.rb +67 -0
- data/test/unit/svnx/info/entries_test.rb +10 -10
- data/test/unit/svnx/info/entry_test.rb +7 -10
- data/test/unit/svnx/log/entries_test.rb +31 -29
- data/test/unit/svnx/log/entry_test.rb +3 -7
- data/test/unit/svnx/status/entries_test.rb +7 -6
- data/test/unit/svnx/status/entry_test.rb +2 -23
- data/test/unit/system/command/cachefile_test.rb +53 -0
- data/test/unit/system/command/caching_test.rb +14 -23
- metadata +83 -64
- data/lib/pvn/describe.rb +0 -40
- data/lib/pvn/diff/diffcmd.rb +0 -49
- data/lib/pvn/diff/diffopts.rb +0 -58
- data/lib/pvn/log/logcmd.rb +0 -135
- data/lib/pvn/log/logentry.rb +0 -116
- data/lib/pvn/log/logfactory.rb +0 -101
- data/lib/pvn/log/logoptions.rb +0 -43
- data/lib/pvn/revision.rb +0 -119
- data/lib/pvn/subcommands/diff/differ.rb +0 -65
- data/lib/pvn/subcommands/diff/local_differ.rb +0 -103
- data/lib/pvn/subcommands/diff/repository_differ.rb +0 -145
- data/lib/pvn/subcommands/pct/clargs.rb +0 -33
- data/lib/pvn/subcommands/pct/options.rb +0 -12
- data/lib/pvn/subcommands/status/options.rb +0 -12
- data/lib/pvn/svn/command/svncmd.rb +0 -39
- data/lib/pvn/svn/environment.rb +0 -23
- data/lib/pvn/svn/svnelement.rb +0 -89
- data/lib/pvn/svn/svninfo.rb +0 -42
- data/lib/pvn/svn/svnroot.rb +0 -29
- data/lib/pvn/upp/uppcmd.rb +0 -112
- data/lib/pvn/wherecmd.rb +0 -55
- data/test/integration/pvn/subcommands/diff/command_test.rb +0 -153
- data/test/integration/pvn/subcommands/log/command_test.rb +0 -22
- data/test/integration/svnx/log/test.rb +0 -43
- data/test/unit/pvn/revision/entry_test.rb +0 -110
- /data/lib/pvn/{subcommands/base → command}/clargs.rb +0 -0
- /data/lib/pvn/{base → util}/color_formatter.rb +0 -0
- /data/lib/pvn/{base → util}/textlines.rb +0 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'integration/tc'
|
5
|
+
require 'pvn/status/command'
|
6
|
+
require 'resources'
|
7
|
+
require 'stringio'
|
8
|
+
|
9
|
+
Log.level = Log::DEBUG
|
10
|
+
|
11
|
+
module PVN::Status
|
12
|
+
class CommandTest < PVN::IntegrationTestCase
|
13
|
+
|
14
|
+
def test_local
|
15
|
+
explines = Array.new
|
16
|
+
|
17
|
+
explines << " \e[33mFirstFile.txt\e[0m"
|
18
|
+
explines << " \e[32mSeventhFile.txt\e[0m"
|
19
|
+
explines << " \e[31mdirzero/SixthFile.txt\e[0m"
|
20
|
+
explines << " src/java/Charlie.java"
|
21
|
+
explines << " \e[32msrc/ruby/dog.rb\e[0m"
|
22
|
+
|
23
|
+
assert_command_output PVN::Status::Command, %w{ }, explines
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/test/unit/pvn/app_test.rb
CHANGED
@@ -1,20 +1,22 @@
|
|
1
1
|
require 'tc'
|
2
2
|
require 'pvn/app'
|
3
|
+
require 'stringio'
|
3
4
|
|
4
5
|
class TestPVNCli < PVN::TestCase
|
5
6
|
def setup
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
stdout_io = StringIO.new
|
8
|
+
# PVN::App::Runner.new stdout_io, Array.new
|
9
|
+
# stdout_io.rewind
|
10
|
+
@stdout = stdout_io.string
|
9
11
|
end
|
10
12
|
|
11
|
-
def
|
13
|
+
def xxx_test_print_default_output
|
12
14
|
# assert_match(/To update this executable/, @stdout)
|
13
15
|
end
|
14
16
|
|
15
17
|
def xxx_test_help
|
16
18
|
io = StringIO.new
|
17
|
-
PVN::App::Runner.
|
19
|
+
PVN::App::Runner.new io, %w{ --help }
|
18
20
|
io.rewind
|
19
21
|
io = io.read
|
20
22
|
# assert_match(/To update this executable/, io)
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'tc'
|
5
|
+
require 'pvn/diff/path_revision'
|
6
|
+
|
7
|
+
module PVN::Diff
|
8
|
+
### $$$ yes, a lot of this is the same as Path; there is overlap as Path
|
9
|
+
### changes to a collection of PathRevisions
|
10
|
+
class PathRevisionTestCase < PVN::TestCase
|
11
|
+
def create_pathrev revision, action
|
12
|
+
PathRevision.new revision, action
|
13
|
+
end
|
14
|
+
|
15
|
+
def assert_pathrev_revision exprevision, revision
|
16
|
+
prev = create_pathrev revision, "added"
|
17
|
+
assert_equal exprevision, prev.revision
|
18
|
+
end
|
19
|
+
|
20
|
+
def assert_pathrev_action expaction, action
|
21
|
+
prev = create_pathrev "0", action
|
22
|
+
assert_equal expaction, prev.action
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_init_revision_string
|
26
|
+
assert_pathrev_revision "0", "0"
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_init_revision_integer
|
30
|
+
assert_pathrev_revision "0", 0
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_init_action_long_string
|
34
|
+
assert_pathrev_action SVNx::Action.new(:added), "added"
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_init_action_short_string
|
38
|
+
assert_pathrev_action SVNx::Action.new(:deleted), "D"
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_init_action_symbol
|
42
|
+
assert_pathrev_action SVNx::Action.new(:modified), :modified
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'tc'
|
5
|
+
require 'pvn/diff/path'
|
6
|
+
|
7
|
+
module PVN::Diff
|
8
|
+
class PathTestCase < PVN::TestCase
|
9
|
+
def create_path name, revision, action, url
|
10
|
+
Path.new name, revision, action, url
|
11
|
+
end
|
12
|
+
|
13
|
+
def assert_path_name expname, name
|
14
|
+
logpath = create_path name, "0", "added", "file:///var/svn/repo"
|
15
|
+
assert_equal expname, logpath.name
|
16
|
+
end
|
17
|
+
|
18
|
+
def assert_path_url expurl, url
|
19
|
+
logpath = create_path "File.txt", "0", "deleted", url
|
20
|
+
assert_equal expurl, logpath.url
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_init_name
|
24
|
+
assert_path_name "File.txt", "File.txt"
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_init_url
|
28
|
+
assert_path_url "file:///var/svn/repo", "file:///var/svn/repo"
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_add_revision
|
32
|
+
path = create_path "File.txt", "0", :added, "file:///var/svn/repo"
|
33
|
+
assert_equal 1, path.path_revisions.size
|
34
|
+
path.add_revision "1", :modified
|
35
|
+
assert_equal 2, path.path_revisions.size
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'tc'
|
5
|
+
require 'pvn/diff/revision'
|
6
|
+
|
7
|
+
module PVN::Diff
|
8
|
+
class RevisionTestCase < PVN::TestCase
|
9
|
+
def to_message change, revision
|
10
|
+
"change: #{change}; revision: #{revision}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def assert_revision_to_s expstr, change, revision
|
14
|
+
rev = RevisionRange.new change, revision
|
15
|
+
assert_equal expstr, rev.to_s, "change: #{change}; revision: #{revision}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def assert_revision_gt exp, chgx, revx, chgy, revy
|
19
|
+
x = RevisionRange.new chgx, revx
|
20
|
+
y = RevisionRange.new chgx, revy
|
21
|
+
msg = "x: #{to_message(chgx, revx)}; y: #{to_message(chgy, revy)}"
|
22
|
+
info "x: #{x}".cyan
|
23
|
+
info "y: #{y}".cyan
|
24
|
+
assert_equal exp, x > y, msg
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_change_str
|
28
|
+
assert_revision_to_s '14:15', '15', nil
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_revision_str
|
32
|
+
assert_revision_to_s '14:15', nil, [ '14', '15' ]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -26,11 +26,11 @@ module PVN::IO::IOElement
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def test_options_none
|
29
|
-
assert_log_command 163, Resources::
|
29
|
+
assert_log_command 163, Resources::PT_PATH
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_option_limit
|
33
|
-
assert_log_command 15, Resources::
|
33
|
+
assert_log_command 15, Resources::PT_PATH, :limit => 15
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -6,13 +6,11 @@ require 'svnx/log/entries'
|
|
6
6
|
require 'pvn/io/element'
|
7
7
|
require 'pvn/log/formatter/entry_formatter'
|
8
8
|
|
9
|
-
require 'resources'
|
10
|
-
|
11
9
|
module PVN; module Log; end; end
|
12
10
|
|
13
11
|
module PVN::Log
|
14
12
|
class EntryFormatTestCase < PVN::TestCase
|
15
|
-
TEST_LINES = Resources::
|
13
|
+
TEST_LINES = Resources::PT_LOG_R19_1_V.readlines
|
16
14
|
ENTRIES = SVNx::Log::Entries.new :xmllines => TEST_LINES
|
17
15
|
|
18
16
|
def show_all entries, from_head, from_tail
|
@@ -20,71 +18,84 @@ module PVN::Log
|
|
20
18
|
puts ef.format
|
21
19
|
end
|
22
20
|
|
23
|
-
def assert_format explines,
|
21
|
+
def assert_format explines, use_colors, idx, from_head, from_tail
|
22
|
+
total = 15
|
23
|
+
entry = ENTRIES[idx]
|
24
24
|
ef = EntryFormatter.new use_colors, entry, idx, from_head, from_tail, total
|
25
25
|
|
26
26
|
fmtlines = ef.format
|
27
|
-
assert_equal explines, fmtlines
|
27
|
+
# assert_equal explines, fmtlines
|
28
|
+
(0 .. [ explines.length, fmtlines.length ].max).each do |lnum|
|
29
|
+
assert_equal explines[lnum], fmtlines[lnum], "line: #{lnum}"
|
30
|
+
end
|
28
31
|
end
|
29
32
|
|
30
33
|
def test_colors_from_head_not_from_tail_index_0
|
31
34
|
entries = ENTRIES
|
32
35
|
explines = [
|
33
|
-
"\e[
|
36
|
+
"\e[1m19\e[0m \e[1m-1\e[0m \e[36m\e[1mLili von Shtupp\e[0m\e[0m \e[35m\e[1m2012-09-16T14:24:07.913759Z\e[0m\e[0m",
|
34
37
|
"",
|
35
|
-
"\e[
|
38
|
+
"\e[37m\e[0m",
|
36
39
|
"",
|
37
|
-
" \e[33m/
|
40
|
+
" \e[33m/SecondFile.txt\e[0m"
|
38
41
|
]
|
39
|
-
assert_format explines,
|
42
|
+
assert_format explines, true, 0, true, false
|
40
43
|
end
|
41
44
|
|
42
|
-
def
|
45
|
+
def test_colors_from_head_not_from_tail_index_3
|
43
46
|
entries = ENTRIES
|
44
47
|
explines = [
|
45
|
-
"\e[
|
48
|
+
"\e[1m16\e[0m \e[1m-4\e[0m \e[36m\e[1mBuddy Bizarre\e[0m\e[0m \e[35m\e[1m2012-09-16T14:07:30.329525Z\e[0m\e[0m",
|
46
49
|
"",
|
47
|
-
"\e[
|
50
|
+
"\e[37mCUT! What in the hell do you think you're doing here? This is a closed set.\e[0m",
|
48
51
|
"",
|
49
|
-
" \e[
|
52
|
+
"\e[1m \e[32m/src/java\e[0m\e[0m",
|
53
|
+
" \e[32m/src/java/Alpha.java\e[0m",
|
54
|
+
" \e[32m/src/java/Bravo.java\e[0m"
|
50
55
|
]
|
51
|
-
assert_format explines,
|
56
|
+
assert_format explines, true, 3, true, false
|
52
57
|
end
|
53
58
|
|
54
|
-
def
|
59
|
+
def test_no_colors_from_head_from_tail_index_3
|
55
60
|
entries = ENTRIES
|
56
61
|
explines = [
|
57
|
-
"
|
62
|
+
"16 -4 +11 Buddy Bizarre 2012-09-16T14:07:30.329525Z",
|
58
63
|
"",
|
59
|
-
"
|
64
|
+
"CUT! What in the hell do you think you're doing here? This is a closed set.",
|
60
65
|
"",
|
61
|
-
" /
|
66
|
+
" /src/java",
|
67
|
+
" /src/java/Alpha.java",
|
68
|
+
" /src/java/Bravo.java"
|
62
69
|
]
|
63
|
-
assert_format explines,
|
70
|
+
assert_format explines, false, 3, true, true
|
64
71
|
end
|
65
72
|
|
66
|
-
def
|
73
|
+
def test_colors_from_head_from_tail_index_3
|
67
74
|
entries = ENTRIES
|
68
75
|
explines = [
|
69
|
-
"\e[
|
76
|
+
"\e[1m16\e[0m \e[1m-4\e[0m \e[1m+11\e[0m \e[36m\e[1mBuddy Bizarre\e[0m\e[0m \e[35m\e[1m2012-09-16T14:07:30.329525Z\e[0m\e[0m",
|
70
77
|
"",
|
71
|
-
"\e[
|
78
|
+
"\e[37mCUT! What in the hell do you think you're doing here? This is a closed set.\e[0m",
|
72
79
|
"",
|
73
|
-
" \e[
|
80
|
+
"\e[1m \e[32m/src/java\e[0m\e[0m",
|
81
|
+
" \e[32m/src/java/Alpha.java\e[0m",
|
82
|
+
" \e[32m/src/java/Bravo.java\e[0m"
|
74
83
|
]
|
75
|
-
assert_format explines,
|
84
|
+
assert_format explines, true, 3, true, true
|
76
85
|
end
|
77
86
|
|
78
|
-
def
|
87
|
+
def test_no_colors_from_head_not_from_tail_index_3
|
79
88
|
entries = ENTRIES
|
80
89
|
explines = [
|
81
|
-
"
|
90
|
+
"16 -4 Buddy Bizarre 2012-09-16T14:07:30.329525Z",
|
82
91
|
"",
|
83
|
-
"
|
92
|
+
"CUT! What in the hell do you think you're doing here? This is a closed set.",
|
84
93
|
"",
|
85
|
-
" /
|
94
|
+
" /src/java",
|
95
|
+
" /src/java/Alpha.java",
|
96
|
+
" /src/java/Bravo.java"
|
86
97
|
]
|
87
|
-
assert_format explines,
|
98
|
+
assert_format explines, false, 3, true, false
|
88
99
|
end
|
89
100
|
end
|
90
101
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
4
|
require 'tc'
|
5
|
-
require 'pvn/
|
5
|
+
require 'pvn/log/options'
|
6
6
|
require 'resources'
|
7
7
|
|
8
8
|
module PVN; module App; module Log; end; end; end
|
@@ -10,7 +10,7 @@ module PVN; module App; module Log; end; end; end
|
|
10
10
|
module PVN::App::Log
|
11
11
|
class OptionsTest < PVN::TestCase
|
12
12
|
def assert_options exp, args
|
13
|
-
options = PVN::
|
13
|
+
options = PVN::Log::OptionSet.new
|
14
14
|
options.process args
|
15
15
|
|
16
16
|
assert_equal exp[:limit], options.limit
|
@@ -24,8 +24,8 @@ module PVN::App::Log
|
|
24
24
|
expdata = Hash.new
|
25
25
|
expdata[:limit] = nil
|
26
26
|
expdata[:revision] = rev
|
27
|
-
expdata[:path] = Resources::
|
28
|
-
assert_options expdata, [ arg, Resources::
|
27
|
+
expdata[:path] = Resources::PT_PATH
|
28
|
+
assert_options expdata, [ arg, Resources::PT_PATH ].flatten
|
29
29
|
end
|
30
30
|
|
31
31
|
def test_default
|
@@ -0,0 +1,157 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'tc'
|
5
|
+
require 'svnx/log/entries'
|
6
|
+
require 'pvn/revision/argument'
|
7
|
+
|
8
|
+
require 'resources'
|
9
|
+
|
10
|
+
module PVN::Revision
|
11
|
+
class ArgumentTestCase < PVN::TestCase
|
12
|
+
def setup
|
13
|
+
# This is the equivalent of "log" at revision 22, when this file was added
|
14
|
+
# at revision 13. Using this instead of just "log" when regenerating the
|
15
|
+
# resource files keeps the revisions from bouncing around.
|
16
|
+
@xmllines = Resources::PT_LOG_R22_13_SECONDFILE_TXT.readlines
|
17
|
+
end
|
18
|
+
|
19
|
+
def create_argument value
|
20
|
+
Argument.new value, @xmllines
|
21
|
+
end
|
22
|
+
|
23
|
+
def assert_argument_value exp_value, value
|
24
|
+
arg = create_argument value
|
25
|
+
assert_equal exp_value, arg.value
|
26
|
+
end
|
27
|
+
|
28
|
+
def assert_argument_value_raises value
|
29
|
+
assert_raises(PVN::Revision::RevisionError) do
|
30
|
+
assert_argument_value nil, value
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def assert_argument_to_s exp_str, value
|
35
|
+
arg = create_argument value
|
36
|
+
assert_equal exp_str, arg.to_s
|
37
|
+
end
|
38
|
+
|
39
|
+
def assert_compare op, exp, xval, yval
|
40
|
+
x = create_argument xval
|
41
|
+
y = create_argument yval
|
42
|
+
msg = "xval: #{xval}; yval: #{yval}"
|
43
|
+
assert_equal exp, x.send(op, y), msg
|
44
|
+
end
|
45
|
+
|
46
|
+
def assert_argument_eq expeq, xval, yval
|
47
|
+
# it's the emoticon programming language
|
48
|
+
assert_compare :==, expeq, xval, yval
|
49
|
+
end
|
50
|
+
|
51
|
+
def assert_argument_gt expeq, xval, yval
|
52
|
+
assert_compare :>, expeq, xval, yval
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_absolute_midrange
|
56
|
+
assert_argument_value 19, 19
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_absolute_most_recent
|
60
|
+
assert_argument_value 22, 22
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_absolute_least_recent
|
64
|
+
assert_argument_value 13, 13
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_absolute_midrange_as_string
|
68
|
+
assert_argument_value 19, '19'
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_absolute_most_recent_as_string
|
72
|
+
assert_argument_value 22, '22'
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_absolute_least_recent_as_string
|
76
|
+
assert_argument_value 13, '13'
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_svn_word
|
80
|
+
%w{ HEAD BASE COMMITTED PREV }.each do |word|
|
81
|
+
assert_argument_value word, word
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_negative_most_recent
|
86
|
+
assert_argument_value 22, -1
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_negative_second_most_recent
|
90
|
+
assert_argument_value 20, -2
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_negative_least_recent
|
94
|
+
assert_argument_value 13, -5
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_negative_too_far_back
|
98
|
+
assert_argument_value_raises(-6)
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_negative_most_recent_as_string
|
102
|
+
assert_argument_value 22, '-1'
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_negative_second_most_recent_as_string
|
106
|
+
assert_argument_value 20, '-2'
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_negative_least_recent_as_string
|
110
|
+
assert_argument_value 13, '-5'
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_negative_too_far_back_as_string
|
114
|
+
assert_argument_value_raises '-6'
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_positive_most_recent
|
118
|
+
assert_argument_value 22, '+5'
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_positive_second_most_recent
|
122
|
+
assert_argument_value 20, '+4'
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_positive_least_recent
|
126
|
+
assert_argument_value 13, '+1'
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_positive_too_far_forward
|
130
|
+
assert_argument_value_raises '+6'
|
131
|
+
end
|
132
|
+
|
133
|
+
def xxxtest_range_svn_word_to_number
|
134
|
+
assert_argument_value 'BASE:1', 'BASE:1'
|
135
|
+
end
|
136
|
+
|
137
|
+
def xxxtest_date
|
138
|
+
assert_argument_to_s '1967-12-10', '1967-12-10'
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_to_s
|
142
|
+
assert_argument_to_s '5', '5'
|
143
|
+
assert_argument_to_s 'HEAD', 'HEAD'
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_eq
|
147
|
+
assert_argument_eq true, '5', '5'
|
148
|
+
assert_argument_eq false, '4', '5'
|
149
|
+
assert_argument_eq false, '5', '4'
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_gt
|
153
|
+
assert_argument_gt true, '17', '16'
|
154
|
+
assert_argument_gt false, '13', '14'
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
@@ -1,9 +1,8 @@
|
|
1
1
|
#!/usr/bin/ruby -w
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
|
-
require 'tc'
|
5
|
-
require 'pvn/
|
6
|
-
require 'pvn/subcommands/revision/tc'
|
4
|
+
require 'pvn/revision/tc'
|
5
|
+
require 'pvn/revision/multiple_revisions_option'
|
7
6
|
|
8
7
|
module PVN
|
9
8
|
class MockMultipleRevisionsRegexpOption < MultipleRevisionsRegexpOption
|
@@ -22,19 +21,19 @@ module PVN
|
|
22
21
|
end
|
23
22
|
|
24
23
|
def test_out_of_range
|
25
|
-
assert_revision_option_raises '-
|
24
|
+
assert_revision_option_raises '-20'
|
26
25
|
end
|
27
26
|
|
28
27
|
def test_post_process_single_middling
|
29
|
-
assert_post_process [ '
|
28
|
+
assert_post_process [ '13' ], [ '-7' ]
|
30
29
|
end
|
31
30
|
|
32
31
|
def test_post_process_single_latest
|
33
|
-
assert_post_process [ '
|
32
|
+
assert_post_process [ '19' ], '-1'
|
34
33
|
end
|
35
34
|
|
36
35
|
def test_post_process_single_oldest
|
37
|
-
assert_post_process [ '
|
36
|
+
assert_post_process [ '1' ], '-19'
|
38
37
|
end
|
39
38
|
|
40
39
|
def test_post_process_single_tagval_unconverted
|
@@ -42,19 +41,19 @@ module PVN
|
|
42
41
|
end
|
43
42
|
|
44
43
|
def test_post_process_single_tagrange_unconverted
|
45
|
-
assert_post_process [ '7:
|
44
|
+
assert_post_process [ '7:17' ], '-r7:17'
|
46
45
|
end
|
47
46
|
|
48
47
|
def test_post_process_multiple_middling
|
49
|
-
assert_post_process [ '
|
48
|
+
assert_post_process [ '13', '19' ], [ '-7', '-1' ]
|
50
49
|
end
|
51
50
|
|
52
51
|
def test_post_process_multiple_relative_tagval_unconverted
|
53
|
-
assert_post_process [ '
|
52
|
+
assert_post_process [ '15', '7' ], [ '-5', '-r7' ]
|
54
53
|
end
|
55
54
|
|
56
55
|
def test_process_tag_value
|
57
|
-
assert_process %w{
|
56
|
+
assert_process %w{ 17 }, %w{ -r 17 }
|
58
57
|
end
|
59
58
|
end
|
60
59
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# -*- ruby -*-
|
3
|
+
|
4
|
+
require 'tc'
|
5
|
+
require 'svnx/log/entries'
|
6
|
+
require 'pvn/revision/range'
|
7
|
+
|
8
|
+
require 'resources'
|
9
|
+
|
10
|
+
module PVN::Revision
|
11
|
+
class RangeTestCase < PVN::TestCase
|
12
|
+
def test_init
|
13
|
+
rr = Range.new '143:199'
|
14
|
+
assert_equal '143', rr.from.to_s
|
15
|
+
assert_equal '199', rr.to.to_s
|
16
|
+
assert_equal '143:199', rr.to_s
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_to_working_copy
|
20
|
+
rr = Range.new '143'
|
21
|
+
assert_equal '143', rr.from.to_s
|
22
|
+
assert_nil rr.to
|
23
|
+
assert_equal '143', rr.to_s
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -1,10 +1,8 @@
|
|
1
1
|
#!/usr/bin/ruby -w
|
2
2
|
# -*- ruby -*-
|
3
3
|
|
4
|
-
require 'tc'
|
5
|
-
require 'pvn/
|
6
|
-
require 'pvn/subcommands/revision/tc'
|
7
|
-
require 'resources'
|
4
|
+
require 'pvn/revision/tc'
|
5
|
+
require 'pvn/revision/revision_option'
|
8
6
|
|
9
7
|
module PVN
|
10
8
|
class MockRevisionOption < RevisionOption
|
@@ -20,45 +18,42 @@ module PVN
|
|
20
18
|
opt.set_value val
|
21
19
|
end
|
22
20
|
|
23
|
-
def assert_relative_to_absolute exp, val
|
21
|
+
def assert_relative_to_absolute exp, val, path = Resources::PT_PATH
|
24
22
|
ropt = MockRevisionOption.new
|
25
|
-
act = ropt.relative_to_absolute val,
|
26
|
-
|
27
|
-
assert_equal exp, act, "val: #{val}; path: #{val}"
|
23
|
+
act = ropt.relative_to_absolute val, path
|
24
|
+
assert_equal exp, act, "val: #{val}; path: #{path}"
|
28
25
|
end
|
29
26
|
|
30
27
|
def test_relative_to_absolute_middling
|
31
|
-
assert_relative_to_absolute '
|
28
|
+
assert_relative_to_absolute '13', '-7'
|
32
29
|
end
|
33
30
|
|
34
31
|
def test_relative_to_absolute_latest
|
35
|
-
assert_relative_to_absolute '
|
32
|
+
assert_relative_to_absolute '19', '-1'
|
36
33
|
end
|
37
34
|
|
38
35
|
def test_relative_to_absolute_oldest
|
39
|
-
assert_relative_to_absolute '
|
36
|
+
assert_relative_to_absolute '1', '-19'
|
40
37
|
end
|
41
38
|
|
42
39
|
def test_out_of_range
|
43
|
-
|
44
|
-
assert_relative_to_absolute '1944', '-164'
|
45
|
-
end
|
40
|
+
assert_revision_option_raises '-20'
|
46
41
|
end
|
47
42
|
|
48
43
|
def test_post_process_absolute_middling
|
49
|
-
assert_post_process '
|
44
|
+
assert_post_process '13', '13'
|
50
45
|
end
|
51
46
|
|
52
47
|
def test_post_process_middling
|
53
|
-
assert_post_process '
|
48
|
+
assert_post_process '13', '-7'
|
54
49
|
end
|
55
50
|
|
56
51
|
def test_post_process_latest
|
57
|
-
assert_post_process '
|
52
|
+
assert_post_process '19', '-1'
|
58
53
|
end
|
59
54
|
|
60
55
|
def test_post_process_oldest
|
61
|
-
assert_post_process '
|
56
|
+
assert_post_process '1', '-19'
|
62
57
|
end
|
63
58
|
end
|
64
59
|
end
|