blastr 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -1
- data/lib/blastr.rb +1 -1
- data/lib/scm/hg.rb +0 -1
- data/lib/scm/svn.rb +1 -2
- data/test/test_mercurial_log.rb +39 -19
- data/test/test_svn_log.rb +46 -18
- metadata +1 -1
data/History.txt
CHANGED
data/lib/blastr.rb
CHANGED
data/lib/scm/hg.rb
CHANGED
data/lib/scm/svn.rb
CHANGED
@@ -53,12 +53,11 @@ module Blastr::SourceControl
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def svn_log_entries(log_output)
|
56
|
-
nonascii = /([^a-zA-Z0-9\.,:;\-_\?!"'\s]+?)/u
|
57
56
|
entries = []
|
58
57
|
log_output.scan(/r(\d+)\s\|\s(.*?)\s\|.*?\n\n(.*?)\n(-)+/mu).each do |entry|
|
59
58
|
revision = as_revision(entry[0])
|
60
59
|
author = entry[1]
|
61
|
-
comment = entry[2]
|
60
|
+
comment = entry[2]
|
62
61
|
entries << LogEntry.new(revision, author, comment)
|
63
62
|
end
|
64
63
|
entries
|
data/test/test_mercurial_log.rb
CHANGED
@@ -7,17 +7,16 @@ class TestMercurialLogParsing < Test::Unit::TestCase
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_one_entry
|
10
|
-
log = <<EOS
|
10
|
+
@log = <<EOS
|
11
11
|
changeset 24:e8a2a4d187773a62f3309b0fa265c13425bc2258 by username:
|
12
12
|
This is the commit message
|
13
13
|
----------------------------------------------------------------------
|
14
14
|
EOS
|
15
|
-
|
16
|
-
assert_equal [ create_entry("24", "username", "This is the commit message") ], entries
|
15
|
+
should_produce_entries [ create_entry("24", "username", "This is the commit message") ]
|
17
16
|
end
|
18
17
|
|
19
18
|
def test_multiple_entries
|
20
|
-
log = <<EOS
|
19
|
+
@log = <<EOS
|
21
20
|
changeset 10:e8a2a4d187773a62f3309b0fa265c13425bc2258 by alf:
|
22
21
|
Revision 10
|
23
22
|
----------------------------------------------------------------------
|
@@ -28,14 +27,32 @@ changeset 8:4ae9f4bfdb98f65bd957e3fe72471b320150b38e by alf:
|
|
28
27
|
Revision 8
|
29
28
|
----------------------------------------------------------------------
|
30
29
|
EOS
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
should_produce_entries [
|
31
|
+
create_entry("10", "alf", "Revision 10"),
|
32
|
+
create_entry("9", "bob", "Revision 9"),
|
33
|
+
create_entry("8", "alf", "Revision 8") ]
|
35
34
|
end
|
36
35
|
|
37
|
-
def
|
38
|
-
log = <<EOS
|
36
|
+
def test_special_characters_in_commit_message
|
37
|
+
@log = <<EOS
|
38
|
+
changeset 10:e8a2a4d187773a62f3309b0fa265c13425bc2258 by cat:
|
39
|
+
Revision 10
|
40
|
+
----------------------------------------------------------------------
|
41
|
+
changeset 9:d7744e86dedc21a8ecf6bdb73eb191b8eaf5b0da by bob:
|
42
|
+
Revision 9 with special ä and ö characters
|
43
|
+
----------------------------------------------------------------------
|
44
|
+
changeset 8:4ae9f4bfdb98f65bd957e3fe72471b320150b38e by alf:
|
45
|
+
Revision 8
|
46
|
+
----------------------------------------------------------------------
|
47
|
+
EOS
|
48
|
+
should_produce_entries [
|
49
|
+
create_entry("10", "cat", "Revision 10"),
|
50
|
+
create_entry("9", "bob", "Revision 9 with special ä and ö characters"),
|
51
|
+
create_entry("8", "alf", "Revision 8") ]
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_dashes_in_the_commit_message
|
55
|
+
@log = <<EOS
|
39
56
|
changeset 123:e8a2a4d187773a62f3309b0fa265c13425bc2258 by ohair:
|
40
57
|
---
|
41
58
|
-----
|
@@ -43,13 +60,11 @@ changeset 123:e8a2a4d187773a62f3309b0fa265c13425bc2258 by ohair:
|
|
43
60
|
- Bullet
|
44
61
|
----------------------------------------------------------------------
|
45
62
|
EOS
|
46
|
-
|
47
|
-
assert_equal [ create_entry("123", "ohair", "---\n-----\n-\n- Bullet") ], entries
|
63
|
+
should_produce_entries [ create_entry("123", "ohair", "---\n-----\n-\n- Bullet") ]
|
48
64
|
end
|
49
65
|
|
50
|
-
|
51
66
|
def test_multiple_multiline_entries_with_empty_lines_within_commit_message
|
52
|
-
log = <<EOS
|
67
|
+
@log = <<EOS
|
53
68
|
changeset 2:e8a2a4d187773a62f3309b0fa265c13425bc2258 by cat:
|
54
69
|
--
|
55
70
|
----------------------------------------------------------------------
|
@@ -60,13 +75,18 @@ changeset 0:4ae9f4bfdb98f65bd957e3fe72471b320150b38e by alf:
|
|
60
75
|
|
61
76
|
----------------------------------------------------------------------
|
62
77
|
EOS
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
78
|
+
should_produce_entries [
|
79
|
+
create_entry("2", "cat", "--"),
|
80
|
+
create_entry("1", "bob", "-"),
|
81
|
+
create_entry("0", "alf", "") ]
|
82
|
+
end
|
68
83
|
|
69
84
|
private
|
85
|
+
|
86
|
+
def should_produce_entries(expected_entries)
|
87
|
+
assert_equal expected_entries, @hg.hg_log_entries(@log)
|
88
|
+
end
|
89
|
+
|
70
90
|
def create_entry(rev_string, author, comment)
|
71
91
|
revision = Blastr::SourceControl::MercurialRevision.new(rev_string)
|
72
92
|
Blastr::SourceControl::LogEntry.new(revision, author, comment)
|
data/test/test_svn_log.rb
CHANGED
@@ -7,19 +7,20 @@ class TestSubversionLogParsing < Test::Unit::TestCase
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_one_entry
|
10
|
-
log = <<EOS
|
10
|
+
@log = <<EOS
|
11
11
|
------------------------------------------------------------------------
|
12
12
|
r123 | username | 2009-01-21 09:02:37 +0200 (Wed, 21 Jan 2009) | 1 line
|
13
13
|
|
14
14
|
The commit message goes here
|
15
15
|
------------------------------------------------------------------------
|
16
16
|
EOS
|
17
|
-
|
18
|
-
|
17
|
+
should_produce_entries [
|
18
|
+
create_entry("123", "username", "The commit message goes here")
|
19
|
+
]
|
19
20
|
end
|
20
21
|
|
21
22
|
def test_multiple_entries
|
22
|
-
log = <<EOS
|
23
|
+
@log = <<EOS
|
23
24
|
------------------------------------------------------------------------
|
24
25
|
r2 | janedoe | 2009-01-22 09:02:00 +0200 (Wed, 21 Jan 2009) | 1 line
|
25
26
|
|
@@ -30,16 +31,14 @@ r1 | johndoe | 2009-01-21 09:03:00 +0200 (Wed, 21 Jan 2009) | 1 line
|
|
30
31
|
First revision
|
31
32
|
------------------------------------------------------------------------
|
32
33
|
EOS
|
33
|
-
|
34
|
-
expected_entries = [
|
34
|
+
should_produce_entries [
|
35
35
|
create_entry("2", "janedoe", "Second revision"),
|
36
36
|
create_entry("1", "johndoe", "First revision")
|
37
|
-
|
38
|
-
assert_equal expected_entries, actual_entries
|
37
|
+
]
|
39
38
|
end
|
40
39
|
|
41
40
|
def test_one_multiline_entry
|
42
|
-
log = <<EOS
|
41
|
+
@log = <<EOS
|
43
42
|
------------------------------------------------------------------------
|
44
43
|
r123 | username | 2009-01-21 09:02:37 +0200 (Wed, 21 Jan 2009) | 1 line
|
45
44
|
|
@@ -48,13 +47,13 @@ Second line
|
|
48
47
|
Third line
|
49
48
|
------------------------------------------------------------------------
|
50
49
|
EOS
|
51
|
-
|
52
|
-
|
50
|
+
should_produce_entries [
|
51
|
+
create_entry("123", "username", "First line\nSecond line\nThird line")
|
52
|
+
]
|
53
53
|
end
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
log = <<EOS
|
55
|
+
def test_multiple_multiline_entries
|
56
|
+
@log = <<EOS
|
58
57
|
------------------------------------------------------------------------
|
59
58
|
r2 | bob | 2009-01-21 09:02:00 +0200 (Wed, 21 Jan 2009) | 1 line
|
60
59
|
|
@@ -67,12 +66,41 @@ First line of r1
|
|
67
66
|
Second line of r1
|
68
67
|
------------------------------------------------------------------------
|
69
68
|
EOS
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
should_produce_entries [
|
70
|
+
create_entry("2", "bob", "First line of r2\nSecond line of r2"),
|
71
|
+
create_entry("1", "alf", "First line of r1\nSecond line of r1")
|
72
|
+
]
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_special_characters_in_commit_message
|
76
|
+
@log = <<EOS
|
77
|
+
------------------------------------------------------------------------
|
78
|
+
r3 | cat | 2009-01-21 09:03:00 +0200 (Wed, 21 Jan 2009) | 1 line
|
79
|
+
|
80
|
+
Revision 3
|
81
|
+
------------------------------------------------------------------------
|
82
|
+
r2 | bob | 2009-01-21 09:02:00 +0200 (Wed, 21 Jan 2009) | 1 line
|
83
|
+
|
84
|
+
Revision 2 with special ö character
|
85
|
+
------------------------------------------------------------------------
|
86
|
+
r1 | alf | 2009-01-21 09:01:00 +0200 (Wed, 21 Jan 2009) | 1 line
|
87
|
+
|
88
|
+
Revision 1
|
89
|
+
------------------------------------------------------------------------
|
90
|
+
EOS
|
91
|
+
should_produce_entries [
|
92
|
+
create_entry("3", "cat", "Revision 3"),
|
93
|
+
create_entry("2", "bob", "Revision 2 with special ö character"),
|
94
|
+
create_entry("1", "alf", "Revision 1")
|
95
|
+
]
|
96
|
+
end
|
74
97
|
|
75
98
|
private
|
99
|
+
|
100
|
+
def should_produce_entries(expected_entries)
|
101
|
+
assert_equal expected_entries, @svn.svn_log_entries(@log)
|
102
|
+
end
|
103
|
+
|
76
104
|
def create_entry(rev_string, author, comment)
|
77
105
|
revision = Blastr::SourceControl::SubversionRevision.new(rev_string)
|
78
106
|
Blastr::SourceControl::LogEntry.new(revision, author, comment)
|