rscm 0.3.13 → 0.3.14

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
+ == Version 0.3.14
4
+
5
+ Improved error messages
6
+
7
+ * Subversion and CVS now raise detailed instructions on how to install triggers in case of failure.
8
+
3
9
  == Version 0.3.13
4
10
 
5
11
  Improved trigger support
data/README CHANGED
@@ -1,4 +1,4 @@
1
- = RSCM - Ruby Source Control Management (0.3.13)
1
+ = RSCM - Ruby Source Control Management (0.3.14)
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
 
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ require 'meta_project'
10
10
 
11
11
  PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
12
12
  PKG_NAME = 'rscm'
13
- PKG_VERSION = '0.3.13' + PKG_BUILD
13
+ PKG_VERSION = '0.3.14' + PKG_BUILD
14
14
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
15
15
 
16
16
  desc "Default Task"
data/lib/rscm/revision.rb CHANGED
@@ -142,10 +142,11 @@ module RSCM
142
142
  self.message = file.message if file.message
143
143
  end
144
144
 
145
- def [] (file)
146
- @files[file]
145
+ def [] (index)
146
+ @files[index]
147
147
  end
148
148
 
149
+ # Iterates over all the RevisionFile objects
149
150
  def each(&block)
150
151
  @files.each(&block)
151
152
  end
@@ -157,6 +158,7 @@ module RSCM
157
158
  def length
158
159
  @files.length
159
160
  end
161
+ alias :size :length
160
162
 
161
163
  def time=(t)
162
164
  raise "time must be a Time object - it was a #{t.class.name} with the string value #{t}" unless t.is_a?(Time)
@@ -190,12 +192,6 @@ module RSCM
190
192
  result
191
193
  end
192
194
 
193
- # Returns the identifier of the revision. This is the revision
194
- # (if defined) or an UTC time if it is not natively supported by the scm.
195
- def identifierAA
196
- @identifier || @time
197
- end
198
-
199
195
  end
200
196
 
201
197
  end
@@ -9,18 +9,28 @@ module RSCM
9
9
  ADDED = "ADDED"
10
10
  MOVED = "MOVED"
11
11
 
12
+ # MODIFIED, DELETED, ADDED or MOVED
12
13
  attr_accessor :status
14
+
15
+ # Relative path from the root of the RSCM::Base instance
13
16
  attr_accessor :path
17
+
18
+ # The native SCM's previous revision for this file. For non-transactional SCMs this is different from
19
+ # the parent Revision's
14
20
  attr_accessor :previous_native_revision_identifier
21
+
15
22
  # The native SCM's revision for this file. For non-transactional SCMs this is different from
16
23
  # the parent Revision's
17
24
  attr_accessor :native_revision_identifier
18
25
 
26
+ # The developer who modified this file
19
27
  attr_accessor :developer
28
+
29
+ # The commit message for this file
20
30
  attr_accessor :message
31
+
21
32
  # This is a UTC ruby time
22
33
  attr_accessor :time
23
- attr_accessor :scm
24
34
 
25
35
  def initialize(path=nil, status=nil, developer=nil, message=nil, native_revision_identifier=nil, time=nil)
26
36
  @path, @developer, @message, @native_revision_identifier, @time, @status = path, developer, message, native_revision_identifier, time, status
@@ -32,43 +42,21 @@ module RSCM
32
42
  scm.open(self, &block)
33
43
  end
34
44
 
45
+ # Yields the diff as an IO for this file
35
46
  def diff(scm, &block)
36
47
  scm.diff(self, &block)
37
48
  end
38
49
 
50
+ # Accepts a visitor that must respond to +visit_file(revision_file)+
39
51
  def accept(visitor)
40
52
  visitor.visit_file(self)
41
53
  end
42
54
 
55
+ # A simple string representation. Useful for debugging.
43
56
  def to_s
44
57
  "#{path} | #{native_revision_identifier}"
45
58
  end
46
59
 
47
- def developer=(developer)
48
- raise "can't be null" if developer.nil?
49
- @developer = developer
50
- end
51
-
52
- def message=(message)
53
- raise "can't be null" if message.nil?
54
- @message = message
55
- end
56
-
57
- def path=(path)
58
- raise "can't be null" if path.nil?
59
- @path = path
60
- end
61
-
62
- def native_revision_identifier=(id)
63
- raise "can't be null" if id.nil?
64
- @native_revision_identifier = id
65
- end
66
-
67
- def time=(time)
68
- raise "time must be a Time object" unless time.is_a?(Time)
69
- @time = time
70
- end
71
-
72
60
  def ==(other)
73
61
  return false if !other.is_a?(self.class)
74
62
  self.path == other.path &&
data/lib/rscm/scm/cvs.rb CHANGED
@@ -121,25 +121,6 @@ module RSCM
121
121
  "CVSROOT/loginfo"
122
122
  end
123
123
 
124
- def install_trigger(trigger_command, trigger_files_checkout_dir)
125
- raise "mod can't be null or empty" if (mod.nil? || mod == "")
126
-
127
- root_cvs = create_root_cvs(trigger_files_checkout_dir)
128
- root_cvs.checkout
129
- with_working_dir(trigger_files_checkout_dir) do
130
- trigger_line = "#{mod} #{trigger_command}\n"
131
- File.open("loginfo", File::WRONLY | File::APPEND) do |file|
132
- file.puts(trigger_line)
133
- end
134
- begin
135
- root_cvs.commit("Installed trigger for CVS module '#{mod}'")
136
- rescue
137
- raise "Couldn't commit the trigger back to CVS. Try to manually check out CVSROOT/loginfo, " +
138
- "add the following line and commit it back:\n\n#{trigger_line}"
139
- end
140
- end
141
- end
142
-
143
124
  def trigger_installed?(trigger_command, trigger_files_checkout_dir)
144
125
  loginfo_line = "#{mod} #{trigger_command}"
145
126
  regex = Regexp.new(Regexp.escape(loginfo_line))
@@ -164,6 +145,27 @@ module RSCM
164
145
  end
165
146
  end
166
147
 
148
+ def install_trigger(trigger_command, trigger_files_checkout_dir)
149
+ raise "mod can't be null or empty" if (mod.nil? || mod == "")
150
+
151
+ root_cvs = create_root_cvs(trigger_files_checkout_dir)
152
+ root_cvs.checkout
153
+ with_working_dir(trigger_files_checkout_dir) do
154
+ trigger_line = "#{mod} #{trigger_command}\n"
155
+ File.open("loginfo", File::WRONLY | File::APPEND) do |file|
156
+ file.puts(trigger_line)
157
+ end
158
+ begin
159
+ root_cvs.commit("Installed trigger for CVS module '#{mod}'")
160
+ rescue
161
+ raise ["Didn't have permission to commit CVSROOT/loginfo.",
162
+ "Try to manually add the following line:",
163
+ trigger_command,
164
+ "Finally make commit the file to the repository"]
165
+ end
166
+ end
167
+ end
168
+
167
169
  def uninstall_trigger(trigger_command, trigger_files_checkout_dir)
168
170
  loginfo_line = "#{mod} #{trigger_command}"
169
171
  regex = Regexp.new(Regexp.escape(loginfo_line))
@@ -11,6 +11,7 @@ module RSCM
11
11
  #
12
12
  # NOTE: On Cygwin these have to be the win32 builds of svn/svnadmin and not the Cygwin ones.
13
13
  class Subversion < Base
14
+
14
15
  include FileUtils
15
16
  include PathConverter
16
17
 
@@ -97,7 +98,8 @@ module RSCM
97
98
  end
98
99
 
99
100
  def open(revision_file, &block)
100
- Better.popen("svn cat --revision #{revision_file.native_revision_identifier} #{url}/#{revision_file.path}") do |io|
101
+ cmd = "svn cat #{url}/#{revision_file.path}@#{revision_file.native_revision_identifier}"
102
+ Better.popen(cmd) do |io|
101
103
  return(yield(io))
102
104
  end
103
105
  end
@@ -242,17 +244,24 @@ module RSCM
242
244
  end
243
245
  File.chmod(0744, post_commit_file)
244
246
  rescue
245
- raise "Didn't have permission to write to #{post_commit_file}. " +
246
- "Try to manually add the following line:\n\n#{trigger_command}\n\n" +
247
- "Finally make it executable with chmod g+x #{post_commit_file}\n\n"
247
+ raise ["Didn't have permission to write to #{post_commit_file}.",
248
+ "Try to manually add the following line:",
249
+ trigger_command,
250
+ "Finally make it executable with chmod g+x #{post_commit_file}"]
248
251
  end
249
252
  end
250
253
 
251
254
  def install_win_trigger(trigger_command, damagecontrol_install_dir)
252
255
  post_commit_exists = File.exists?(post_commit_file)
253
256
  mode = post_commit_exists ? File::APPEND|File::WRONLY : File::CREAT|File::WRONLY
254
- File.open(post_commit_file, mode) do |file|
255
- file.puts("#{trigger_command}\n" )
257
+ begin
258
+ File.open(post_commit_file, mode) do |file|
259
+ file.puts("#{trigger_command}\n" )
260
+ end
261
+ rescue
262
+ raise ["Didn't have permission to write to #{post_commit_file}.",
263
+ "Try to manually add the following line:",
264
+ trigger_command]
256
265
  end
257
266
  end
258
267
 
@@ -366,7 +375,11 @@ module RSCM
366
375
  def post_commit_file
367
376
  # We actualy need to use the .cmd when on cygwin. The cygwin svn post-commit
368
377
  # hook is hosed. We'll be relying on native windows
369
- WINDOWS ? "#{svnrootdir}/hooks/post-commit.cmd" : "#{svnrootdir}/hooks/post-commit"
378
+ if(local?)
379
+ WINDOWS ? "#{svnrootdir}/hooks/post-commit.cmd" : "#{svnrootdir}/hooks/post-commit"
380
+ else
381
+ raise "The repository is not local. Cannot install or uninstall trigger."
382
+ end
370
383
  end
371
384
 
372
385
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
3
3
  specification_version: 1
4
4
  name: rscm
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.13
7
- date: 2005-11-14
6
+ version: 0.3.14
7
+ date: 2005-11-16
8
8
  summary: "RSCM - Ruby Source Control Management"
9
9
  require_paths:
10
10
  - lib