rscm 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +6 -0
- data/README +1 -1
- data/lib/rscm/scm/subversion.rb +4 -2
- data/lib/rscm/scm/subversion_log_parser.rb +19 -17
- data/lib/rscm/version.rb +1 -1
- data/test/rscm/scm/subversion_log_parser_test.rb +21 -2
- metadata +1 -1
data/CHANGES
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
= RSCM Changelog
|
2
2
|
|
3
|
+
== 0.4.3
|
4
|
+
|
5
|
+
This release fixes a subtle bug in revision detection for Subversion
|
6
|
+
|
7
|
+
* Reintroduced the path parameter for svn log parser. It will be used as a fallback if a file path cannot be determined from looking at the URL. A RSCM::Subversion object with a URL pointing to the root of the repo *MUST* also specify path="", otherwise no files will be detected in the revisions. Instances with URLs that represent a subdirectory of the root URL don't need to specify path, unless the instance is used to install/uninstall triggers - or to create repositories.
|
8
|
+
|
3
9
|
== 0.4.2
|
4
10
|
|
5
11
|
This release fixes a number of subtle bugs related to command lines and logging
|
data/README
CHANGED
data/lib/rscm/scm/subversion.rb
CHANGED
@@ -16,6 +16,8 @@ module RSCM
|
|
16
16
|
include PathConverter
|
17
17
|
|
18
18
|
attr_accessor :url
|
19
|
+
# Must be specified in order to create repo and install triggers.
|
20
|
+
# Must also be specified as "" if the url represents the root of the repository, or files in revisions will not be detected.
|
19
21
|
attr_accessor :path
|
20
22
|
attr_accessor :username
|
21
23
|
attr_accessor :password
|
@@ -76,7 +78,7 @@ module RSCM
|
|
76
78
|
end
|
77
79
|
|
78
80
|
def can_create_central?
|
79
|
-
local?
|
81
|
+
local? && !path.nil? && !(path == "")
|
80
82
|
end
|
81
83
|
|
82
84
|
def destroy_central
|
@@ -168,7 +170,7 @@ module RSCM
|
|
168
170
|
revisions = nil
|
169
171
|
command = "svn #{changes_command(options[:from_identifier], options[:to_identifier], options[:relative_path])}"
|
170
172
|
execute(command, options) do |stdout|
|
171
|
-
parser = SubversionLogParser.new(stdout, @url, options[:from_identifier])
|
173
|
+
parser = SubversionLogParser.new(stdout, @url, options[:from_identifier], @path)
|
172
174
|
revisions = parser.parse_revisions
|
173
175
|
end
|
174
176
|
revisions
|
@@ -4,9 +4,9 @@ require 'rscm/revision'
|
|
4
4
|
module RSCM
|
5
5
|
|
6
6
|
class SubversionLogParser
|
7
|
-
def initialize(io, url, exclude_below=nil)
|
7
|
+
def initialize(io, url, exclude_below=nil, path=nil)
|
8
8
|
@io = io
|
9
|
-
@revision_parser = SubversionLogEntryParser.new(url)
|
9
|
+
@revision_parser = SubversionLogEntryParser.new(url, path)
|
10
10
|
@exclude_below = exclude_below
|
11
11
|
end
|
12
12
|
|
@@ -34,9 +34,10 @@ module RSCM
|
|
34
34
|
|
35
35
|
class SubversionLogEntryParser < Parser
|
36
36
|
|
37
|
-
def initialize(url)
|
37
|
+
def initialize(url, path=nil)
|
38
38
|
super(/^------------------------------------------------------------------------/)
|
39
39
|
@url = url
|
40
|
+
@path = path
|
40
41
|
end
|
41
42
|
|
42
43
|
def parse(io, skip_line_parsing=false, &line_proc)
|
@@ -46,15 +47,15 @@ module RSCM
|
|
46
47
|
revision
|
47
48
|
end
|
48
49
|
|
49
|
-
def relative_path(url,
|
50
|
-
|
50
|
+
def relative_path(url, path_from_root)
|
51
|
+
path_from_root = path_from_root.chomp
|
51
52
|
url_tokens = url.split('/')
|
52
|
-
|
53
|
+
path_from_root_tokens = path_from_root.split('/')
|
53
54
|
|
54
|
-
max_similar =
|
55
|
+
max_similar = path_from_root_tokens.length
|
55
56
|
while(max_similar > 0)
|
56
57
|
url = url_tokens[-max_similar..-1]
|
57
|
-
path =
|
58
|
+
path = path_from_root_tokens[0..max_similar-1]
|
58
59
|
if(url == path)
|
59
60
|
break
|
60
61
|
end
|
@@ -63,7 +64,7 @@ module RSCM
|
|
63
64
|
if(max_similar == 0)
|
64
65
|
nil
|
65
66
|
else
|
66
|
-
|
67
|
+
path_from_root_tokens[max_similar..-1].join("/")
|
67
68
|
end
|
68
69
|
end
|
69
70
|
|
@@ -132,14 +133,15 @@ module RSCM
|
|
132
133
|
path_from_root.gsub!(/\\/, "/")
|
133
134
|
path_from_root = path_from_root[1..-1]
|
134
135
|
rp = relative_path(@url, path_from_root)
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
136
|
+
if rp.nil?
|
137
|
+
if !@path.nil?
|
138
|
+
file.path = path_from_root[@path.length..-1]
|
139
|
+
else
|
140
|
+
return
|
141
|
+
end
|
142
|
+
else
|
143
|
+
file.path = rp
|
144
|
+
end
|
143
145
|
|
144
146
|
file.native_revision_identifier = @revision.identifier
|
145
147
|
# http://jira.codehaus.org/browse/DC-204
|
data/lib/rscm/version.rb
CHANGED
@@ -136,7 +136,7 @@ Updated website for 1.1.2 release.
|
|
136
136
|
EOF
|
137
137
|
|
138
138
|
def test_should_filter_out_unwanted_entries
|
139
|
-
parser = SubversionLogParser.new(StringIO.new(SVN_XSTREAM_LOG), "svn://foo/trunk/xstream")
|
139
|
+
parser = SubversionLogParser.new(StringIO.new(SVN_XSTREAM_LOG), "svn://foo/trunk/xstream/")
|
140
140
|
revisions = parser.parse_revisions
|
141
141
|
assert_equal(593, revisions[0].identifier)
|
142
142
|
assert_equal("build.xml", revisions[0][0].path)
|
@@ -174,7 +174,7 @@ EOF
|
|
174
174
|
assert_equal(4, revisions[0].length)
|
175
175
|
end
|
176
176
|
|
177
|
-
def
|
177
|
+
def test_should_find_relative_path_by_matching
|
178
178
|
slep = SubversionLogEntryParser.new(nil)
|
179
179
|
url = "svn://svn.xstream.codehaus.org/xstream/scm/trunk/xstream"
|
180
180
|
assert_equal("build.xml", slep.relative_path(url, "trunk/xstream/build.xml"))
|
@@ -204,5 +204,24 @@ EOF
|
|
204
204
|
assert_equal("abit/funny?/bla/bla", revisions[0][1].path)
|
205
205
|
assert_equal("abit/funny*/bla/bla", revisions[0][2].path)
|
206
206
|
end
|
207
|
+
|
208
|
+
NO_PREFIX_LOG = <<-EOF
|
209
|
+
------------------------------------------------------------------------
|
210
|
+
r4 | aslakhellesoy | 2006-02-27 12:03:48 -0600 (Mon, 27 Feb 2006) | 1 line
|
211
|
+
Changed paths:
|
212
|
+
M /Rakefile
|
213
|
+
M /lib/foo.rb
|
214
|
+
|
215
|
+
bugzzz
|
216
|
+
------------------------------------------------------------------------
|
217
|
+
EOF
|
218
|
+
|
219
|
+
# We support paths from root only if path is specified
|
220
|
+
def test_no_prefix_log
|
221
|
+
parser = SubversionLogParser.new(StringIO.new(NO_PREFIX_LOG), "svn://mooky/funny/", nil, "")
|
222
|
+
revisions = parser.parse_revisions
|
223
|
+
assert_equal("Rakefile", revisions[0][0].path)
|
224
|
+
assert_equal("lib/foo.rb", revisions[0][1].path)
|
225
|
+
end
|
207
226
|
end
|
208
227
|
end
|