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 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
@@ -1,4 +1,4 @@
1
- = RSCM - Ruby Source Control Management (0.4.2)
1
+ = RSCM - Ruby Source Control Management (0.4.3)
2
2
 
3
3
  RSCM is to SCM what DBI/JDBC/ODBC are to databases - an SCM-independent API for accessing different SCMs. The high level features are roughly:
4
4
 
@@ -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, repo_path)
50
- repo_path = repo_path.chomp
50
+ def relative_path(url, path_from_root)
51
+ path_from_root = path_from_root.chomp
51
52
  url_tokens = url.split('/')
52
- repo_path_tokens = repo_path.split('/')
53
+ path_from_root_tokens = path_from_root.split('/')
53
54
 
54
- max_similar = repo_path_tokens.length
55
+ max_similar = path_from_root_tokens.length
55
56
  while(max_similar > 0)
56
57
  url = url_tokens[-max_similar..-1]
57
- path = repo_path_tokens[0..max_similar-1]
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
- repo_path_tokens[max_similar..-1].join("/")
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
- return if rp.nil?
136
- file.path = rp
137
-
138
- # if(@path.length+1 == path_from_root.length)
139
- # file.path = path_from_root[@path.length+1..-1]
140
- # else
141
- # file.path = path_from_root[@path.length+2..-1]
142
- # end
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
@@ -2,7 +2,7 @@ module RSCM
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
 
@@ -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 test_should_not_require_path
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
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: rscm
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.2
6
+ version: 0.4.3
7
7
  date: 2006-02-27 00:00:00 -06:00
8
8
  summary: RSCM - Ruby Source Control Management
9
9
  require_paths: