rscm 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES ADDED
@@ -0,0 +1,21 @@
1
+ = RSCM Changelog
2
+
3
+ == Version 0.3.1
4
+
5
+ This is a bugfix release.
6
+
7
+ * Added move method to Subversion, CVS, Monotone and Perforce (although it doesn't work on the latter two)
8
+ * SCM classes no longer include FileUtils (conflicted with new move method)
9
+ * Fixed DC-427 (couldn't parse regexp chars *,+ and ? in subversion logs)
10
+
11
+ == Version 0.3.0
12
+
13
+ * Removed checkout_dir from all methods. It's now a mandatory attribute on the SCM objects.
14
+ * Made logging more pluggable
15
+
16
+ == Version 0.2.1
17
+
18
+ * Implemented add method for monotone
19
+ * Fixed monotone test and added some doco
20
+ * Add server and port options to Monotone::initialize
21
+ * Added changelog file
data/README CHANGED
@@ -23,6 +23,7 @@ If you want the latest and greatest, you can get the sources, which live alongsi
23
23
  * See the DamageControl Developer Guide at http://hieraki.lavalamp.ca/
24
24
 
25
25
  == Team
26
+
26
27
  * Aslak Hellesoy - All
27
28
  * Steven Baker - Monotone
28
29
  * Jon Tirsen - CVS, Subversion
data/Rakefile CHANGED
@@ -6,26 +6,27 @@ require 'rake/packagetask'
6
6
  require 'rake/gempackagetask'
7
7
  require 'rake/contrib/sshpublisher'
8
8
  require 'rake/contrib/rubyforgepublisher'
9
- require 'xforge'
9
+ 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.0' + PKG_BUILD
13
+ PKG_VERSION = '0.3.1' + PKG_BUILD
14
14
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
15
15
 
16
16
  desc "Default Task"
17
- task :default => [ :all ]
18
- task :all => [:ant, :gem]
17
+ task :default => [:gem]
18
+ #task :gem => [:test]
19
+ task :test => [:starteam]
19
20
 
20
21
  # Run the unit tests
21
22
  # To run a specific test: rake test TEST=path/to/test
22
23
  fl = FileList.new('test/**/*_test.rb')
23
24
  fl.exclude('test/**/mooky*.rb')
24
- #fl.exclude('test/**/monotone*.rb') # Incomplete/unsupported for now - reactivate when more complete!
25
+ fl.exclude('test/**/monotone*.rb') # Incomplete/unsupported for now - reactivate when more complete!
25
26
  fl.exclude('test/**/clearcase*.rb') # Incomplete/unsupported for now - reactivate when more complete!
26
27
  fl.exclude('test/**/darcs*.rb') # Incomplete/unsupported for now - reactivate when more complete!
27
- #fl.exclude('test/**/perforce*.rb') # Incomplete/unsupported for now - reactivate when more complete!
28
- #fl.exclude('test/**/p4client*.rb') # Incomplete/unsupported for now - reactivate when more complete!
28
+ fl.exclude('test/**/perforce*.rb') # Incomplete/unsupported for now - reactivate when more complete!
29
+ fl.exclude('test/**/p4client*.rb') # Incomplete/unsupported for now - reactivate when more complete!
29
30
  fl.exclude('test/**/starteam*.rb') # Too bloody hard to test without a StarTeam server license! Tested ad-hoc.
30
31
  Rake::TestTask.new { |t|
31
32
  t.libs << "test"
@@ -37,14 +38,14 @@ rd = Rake::RDocTask.new { |rdoc|
37
38
  rdoc.title = 'RSCM - Ruby Source Control Management API'
38
39
  rdoc.options << '--line-numbers' << '--inline-source'
39
40
  rdoc.rdoc_files.include('README')
40
- rdoc.rdoc_files.include('CHANGELOG')
41
+ rdoc.rdoc_files.include('CHANGES')
41
42
  rdoc.rdoc_files.include('lib/**/*.rb')
42
43
  rdoc.rdoc_files.include('docs/**/*.rd')
43
44
  }
44
45
 
45
- task :ant do |t|
46
+ task :starteam do |t|
46
47
  if(!ENV['RSCM_STARTEAM'])
47
- puts "WARNING - NOT BUILDING STARTEAM SUPPORT SINCE 'RSCM_STARTEAM' IS NOT DEFINED."
48
+ puts "WARNING - NOT BUILDING STARTEAM SUPPORT SINCE 'RSCM_STARTEAM' IS NOT DEFINED. It should point to the StarTeam SDK directory"
48
49
  else
49
50
  ant = RUBY_PLATFORM == "i386-mswin32" ? "ant.bat" : system("which ant.sh") ? "ant.sh" : "ant"
50
51
  IO.popen("#{ant} -f ext/java/build.xml clean jar") do |io|
@@ -110,23 +111,43 @@ else
110
111
  end
111
112
  end
112
113
 
113
- task :release => [:publish_doc, :publish_files]
114
+ task :release => [:verify_env_vars, :release_files, :publish_doc, :publish_news]
114
115
 
115
- task :publish_files => [:gem] do
116
+ task :verify_env_vars do
117
+ raise "RUBYFORGE_USER environment variable not set!" unless ENV['RUBYFORGE_USER']
118
+ raise "RUBYFORGE_PASSWORD environment variable not set!" unless ENV['RUBYFORGE_PASSWORD']
119
+ end
120
+
121
+ desc "Release files on RubyForge"
122
+ task :release_files => [:gem] do
116
123
  release_files = FileList[
117
- "pkg/#{PKG_FILE_NAME}.gem",
118
- "CHANGES"
124
+ "pkg/#{PKG_FILE_NAME}.gem"
119
125
  ]
120
126
 
121
- Rake::XForge::Release.new(PKG_NAME) do |xf|
122
- # Never hardcode user name and password in the Rakefile!
123
- xf.user_name = ENV['RUBYFORGE_USER']
124
- xf.password = ENV['RUBYFORGE_PASSWORD']
125
- xf.files = release_files.to_a
126
- xf.release_name = "XForge #{PKG_VERSION}"
127
- end
127
+ Rake::XForge::Release.new(MetaProject::Project::XForge::RubyForge.new(PKG_NAME)) do |release|
128
+ # Never hardcode user name and password in the Rakefile!
129
+ release.user_name = ENV['RUBYFORGE_USER']
130
+ release.password = ENV['RUBYFORGE_PASSWORD']
131
+ release.files = release_files.to_a
132
+ release.release_name = PKG_FILE_NAME
133
+ # The rest of the options are defaults (among others, release_notes and release_changes, parsed from CHANGES)
134
+ end
128
135
  end
129
136
 
130
137
  task :publish_doc => [:rdoc] do
131
- publisher = Rake::RubyForgePublisher.new('rscm', 'aslak_hellesoy')
138
+ publisher = Rake::RubyForgePublisher.new(PKG_NAME, ENV['RUBYFORGE_USER'])
139
+ publisher.upload
140
+ end
141
+
142
+ desc "Publish news on RubyForge"
143
+ task :publish_news => [:gem] do
144
+ release_files = FileList[
145
+ "pkg/#{PKG_FILE_NAME}.gem"
146
+ ]
147
+
148
+ Rake::XForge::NewsPublisher.new(MetaProject::Project::XForge::RubyForge.new(PKG_NAME)) do |news|
149
+ # Never hardcode user name and password in the Rakefile!
150
+ news.user_name = ENV['RUBYFORGE_USER']
151
+ news.password = ENV['RUBYFORGE_PASSWORD']
152
+ end
132
153
  end
data/lib/rscm/base.rb CHANGED
@@ -12,12 +12,14 @@ module RSCM
12
12
  # as well as an associated 'central' repository. The main responsibility is working
13
13
  # copy operations:
14
14
  #
15
+ # * add
15
16
  # * checkout
16
- # * revisions
17
- # * uptodate?
18
17
  # * checked_out?
19
18
  # * diff
20
19
  # * edit
20
+ # * move
21
+ # * revisions
22
+ # * uptodate?
21
23
  #
22
24
  # In addition to operations related to working copies, the same instance should provide
23
25
  # methods to administer the working copy's associated 'central' repository. These are:
@@ -26,19 +28,19 @@ module RSCM
26
28
  # * create_central
27
29
  # * can_create_central?
28
30
  # * import_central
31
+ # * install_trigger
29
32
  # * supports_trigger? # TODO: rename to can_install_trigger?
30
33
  # * trigger_installed?
31
- # * install_trigger
32
34
  # * uninstall_trigger
33
35
  #
34
36
  # Some methods are a bit fuzzy with respect to their relevance to the working copy or
35
37
  # the associated central repository, as it depends on the nature of the individual underlying
36
38
  # SCMs. These methods are:
37
39
  #
40
+ # * checkout_command_line
38
41
  # * label
39
42
  # * name
40
43
  # * transactional?
41
- # * checkout_command_line
42
44
  # * update_command_line
43
45
  #
44
46
  # Some of the methods in this API use +from_identifier+ and +to_identifier+.
@@ -52,7 +54,6 @@ module RSCM
52
54
  # TODO: rename this superclass to 'Base'
53
55
  #
54
56
  class Base
55
- include FileUtils
56
57
 
57
58
  @@classes = []
58
59
  def self.register(cls)
@@ -110,13 +111,13 @@ module RSCM
110
111
  raise "Not implemented"
111
112
  end
112
113
 
113
- # Destroysthe central repository. Shuts down any server processes and deletes the repository.
114
- # WARNING: calling this may result in loss of data. Only call this if you really want to wipe it out for good!
114
+ # Destroys the central repository. Shuts down any server processes and deletes the repository.
115
+ # WARNING: calling this may result in loss of data. Only call this if you really want to wipe
116
+ # it out for good!
115
117
  def destroy_central
116
118
  end
117
119
 
118
120
  # Whether a repository can be created.
119
- #
120
121
  def can_create_central?
121
122
  false
122
123
  end
@@ -125,23 +126,24 @@ module RSCM
125
126
  def add(relative_filename)
126
127
  end
127
128
 
128
- # Recursively imports files from a directory into the central scm
129
- #
130
- def import_central(dir, message)
131
- raise "Not implemented"
129
+ # Schedules a move of +relative_src+ to +relative_dest+
130
+ # Should not take effect in the central repository until
131
+ # +commit+ is invoked.
132
+ def move(relative_src, relative_dest)
132
133
  end
133
134
 
134
- # The display name of this SCM
135
- #
136
- def name
137
- # Should be overridden by subclasses to display a nicer name
138
- self.class.name
135
+ # Recursively imports files from a +dir+ into the central scm
136
+ def import_central(dir, message)
137
+ raise "Not implemented"
139
138
  end
140
139
 
141
- # Open a file for edit - required by scms that checkout files in read-only mode e.g. perforce
142
- #
140
+ # Open a file for edit - required by scms that check out files in read-only mode e.g. perforce
143
141
  def edit(file)
144
142
  end
143
+
144
+ # Commit (check in) modified files.
145
+ def commit(message)
146
+ end
145
147
 
146
148
  # Checks out or updates contents from a central SCM to +checkout_dir+ - a local working copy.
147
149
  # If this is a distributed SCM, this method should create a 'working copy' repository
data/lib/rscm/logging.rb CHANGED
@@ -1,5 +1,12 @@
1
+ require 'rscm/path_converter'
1
2
  require 'logger'
2
3
 
4
+ if(WINDOWS)
5
+ HOMEDIR = RSCM::PathConverter.nativepath_to_filepath("#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}").gsub(/\\/, "/")
6
+ else
7
+ HOMEDIR = ENV['HOME']
8
+ end
9
+
3
10
  begin
4
11
  RSCM_DEFAULT_LOGGER = Logger.new("#{HOMEDIR}/.rscm.log")
5
12
  rescue StandardError
File without changes
@@ -1,14 +1,8 @@
1
1
  WIN32 = RUBY_PLATFORM == "i386-mswin32"
2
2
  CYGWIN = RUBY_PLATFORM == "i386-cygwin"
3
3
  WINDOWS = WIN32 || CYGWIN
4
- if(WINDOWS)
5
- HOMEDIR = RSCM::PathConverter.nativepath_to_filepath("#{ENV['HOMEDRIVE']}#{ENV['HOMEPATH']}").gsub(/\\/, "/")
6
- else
7
- HOMEDIR = ENV['HOME']
8
- end
9
4
 
10
5
  require 'fileutils'
11
- require 'rscm/logging'
12
6
 
13
7
  def with_working_dir(dir)
14
8
  # Can't use Dir.chdir{ block } - will fail with multithreaded code.
@@ -7,10 +7,6 @@ module RSCM
7
7
 
8
8
  LOG_FORMAT = "Developer:%u\\nTime:%Nd\\nExtendedName:%Xn\\nVersionId:%Vn\\nPreviousVersionId:%PVn\\nElementName:%En\\nOID:%On\\nO:%o\\nMessage:%Nc\\n------------------------------------------\\n"
9
9
 
10
- def name
11
- "ClearCase"
12
- end
13
-
14
10
  def revisions(checkout_dir, from_identifier, to_identifier=Time.infinity)
15
11
  result = Revisions.new
16
12
  with_working_dir(checkout_dir) do
data/lib/rscm/scm/cvs.rb CHANGED
@@ -29,10 +29,6 @@ module RSCM
29
29
  @root, @mod, @branch, @password = root, mod, branch, password
30
30
  end
31
31
 
32
- def name
33
- "CVS"
34
- end
35
-
36
32
  def import_central(dir, message)
37
33
  modname = File.basename(dir)
38
34
  cvs(dir, "import -m \"#{message}\" #{modname} VENDOR START")
@@ -42,6 +38,13 @@ module RSCM
42
38
  cvs(@checkout_dir, "add #{relative_filename}")
43
39
  end
44
40
 
41
+ def move(relative_src, relative_dest)
42
+ FileUtils.mv(@checkout_dir + '/' + relative_src, @checkout_dir + '/' + relative_dest, :force=>true)
43
+ cvs(@checkout_dir, "rm #{relative_src}")
44
+ # This will fail if the directories are new. More advanced support for adding can be added if needed.
45
+ cvs(@checkout_dir, "add #{relative_dest}")
46
+ end
47
+
45
48
  # The extra simulate parameter is not in accordance with the AbstractSCM API,
46
49
  # but it's optional and is only being used from within this class (uptodate? method).
47
50
  def checkout(to_identifier=nil, simulate=false)
@@ -59,7 +62,7 @@ module RSCM
59
62
  prefix = File.basename(@checkout_dir)
60
63
  path_regex = /^[U|P] #{prefix}\/(.*)/
61
64
  # This is a workaround for the fact that -d . doesn't work - must be an existing sub folder.
62
- mkdir_p(@checkout_dir) unless File.exist?(@checkout_dir)
65
+ FileUtils.mkdir_p(@checkout_dir) unless File.exist?(@checkout_dir)
63
66
  target_dir = File.basename(@checkout_dir)
64
67
  run_checkout_command_dir = File.dirname(@checkout_dir)
65
68
  # -D is sticky, but subsequent updates will reset stickiness with -A
@@ -74,8 +77,8 @@ module RSCM
74
77
  checked_out_files
75
78
  end
76
79
 
77
- def commit(message, &proc)
78
- cvs(@checkout_dir, commit_command(message), &proc)
80
+ def commit(message)
81
+ cvs(@checkout_dir, commit_command(message))
79
82
  end
80
83
 
81
84
  def uptodate?(identifier)
@@ -13,10 +13,6 @@ module RSCM
13
13
  @dir = File.expand_path(dir)
14
14
  end
15
15
 
16
- def name
17
- "Darcs"
18
- end
19
-
20
16
  def can_create_central?
21
17
  true
22
18
  end
@@ -91,6 +87,10 @@ module RSCM
91
87
  end
92
88
  end
93
89
 
90
+ def supports_trigger?
91
+ true
92
+ end
93
+
94
94
  protected
95
95
 
96
96
  def checkout_silent(to_identifier) # :yield: file
@@ -33,10 +33,6 @@ module RSCM
33
33
  @central_checkout_dir = File.expand_path(central_checkout_dir) unless central_checkout_dir.nil?
34
34
  end
35
35
 
36
- def name
37
- "Monotone"
38
- end
39
-
40
36
  def add(relative_filename)
41
37
  db = db(@checkout_dir)
42
38
  with_working_dir(@checkout_dir) do
@@ -44,6 +40,13 @@ module RSCM
44
40
  end
45
41
  end
46
42
 
43
+ def move(relative_src, relative_dest)
44
+ with_working_dir(@checkout_dir) do
45
+ monotone("rename #{relative_src} #{relative_dest}", db)
46
+ FileUtils.mv(relative_src, relative_dest)
47
+ end
48
+ end
49
+
47
50
  def can_create_central?
48
51
  @server == "localhost" && !@central_checkout_dir.nil?
49
52
  end
@@ -108,7 +111,7 @@ module RSCM
108
111
  end
109
112
 
110
113
  def import_central(dir, message)
111
- cp_r(Dir["#{dir}/*"], @central_checkout_dir)
114
+ FileUtils.cp_r(Dir["#{dir}/*"], @central_checkout_dir)
112
115
  with_working_dir(@central_checkout_dir) do
113
116
  monotone("add .")
114
117
  commit_in_dir(message, @central_checkout_dir)
@@ -152,6 +155,10 @@ module RSCM
152
155
  end
153
156
  end
154
157
 
158
+ def supports_trigger?
159
+ true
160
+ end
161
+
155
162
  # http://www.venge.net/monotone/monotone.html#Hook-Reference
156
163
  def install_trigger(trigger_command, install_dir)
157
164
  stop_serve
@@ -13,9 +13,5 @@ module RSCM
13
13
  def initialize(foo="", bar="chocolate bar")
14
14
  end
15
15
 
16
- def name
17
- "Mooky"
18
- end
19
-
20
16
  end
21
17
  end
@@ -17,8 +17,6 @@ module RSCM
17
17
  class Perforce < Base
18
18
  register self
19
19
 
20
- include FileUtils
21
-
22
20
  @@counter = 0
23
21
 
24
22
  ann :description => "P4CLIENT: workspace name"
@@ -69,8 +67,8 @@ module RSCM
69
67
  true
70
68
  end
71
69
 
72
- def name
73
- "Perforce"
70
+ def supports_trigger?
71
+ true
74
72
  end
75
73
 
76
74
  def transactional?
@@ -92,6 +90,10 @@ module RSCM
92
90
  p4client.add(relative_filename)
93
91
  end
94
92
 
93
+ def move(relative_src, relative_dest)
94
+ p4client.move(checkout_dir, relative_src, relative_dest)
95
+ end
96
+
95
97
  def commit(message, &proc)
96
98
  p4client.submit(message, &proc)
97
99
  end
@@ -130,7 +132,7 @@ module RSCM
130
132
  raise "needs a block" unless block_given?
131
133
  rootdir = File.expand_path(rootdir)
132
134
  with_working_dir(rootdir) do
133
- mkdir_p(rootdir)
135
+ FileUtils.mkdir_p(rootdir)
134
136
  client = p4admin.create_client(rootdir, Perforce.next_client_name)
135
137
  begin
136
138
  yield client
@@ -272,6 +274,18 @@ module RSCM
272
274
  def add(relative_path)
273
275
  add_file(rootdir + "/" + relative_path)
274
276
  end
277
+
278
+ # http://www.perforce.com/perforce/doc.051/manuals/cmdref/rename.html#1040665
279
+ def move(checkout_dir, relative_src, relative_dest)
280
+ with_working_dir(checkout_dir) do
281
+ absolute_src = PathConverter.filepath_to_nativepath(relative_src, true)
282
+ absolute_dest = PathConverter.filepath_to_nativepath(relative_dest, true)
283
+ FileUtils.mv(absolute_src, absolute_dest)
284
+ p4("integrate #{absolute_src} #{absolute_dest}")
285
+ p4("delete #{absolute_src}")
286
+ end
287
+ # p4("submit #{absolute_src}")
288
+ end
275
289
 
276
290
  def add_all(files)
277
291
  files.each {|file| add_file(file)}
@@ -45,10 +45,6 @@ module RSCM
45
45
  @user_name, @password, @server_name, @server_port, @project_name, @view_name, @folder_name = user_name, password, server_name, server_port, project_name, view_name, folder_name
46
46
  end
47
47
 
48
- def name
49
- "StarTeam"
50
- end
51
-
52
48
  def revisions(checkout_dir, from_identifier=Time.epoch, to_identifier=Time.infinity, &proc)
53
49
  # just assuming it is a Time for now, may support labels later.
54
50
  # the java class really wants rfc822 and not rfc2822, but this works ok anyway.
@@ -73,6 +69,10 @@ module RSCM
73
69
  files = java("checkout(\"#{checkout_dir}\")", &proc)
74
70
  files
75
71
  end
72
+
73
+ def supports_trigger?
74
+ true
75
+ end
76
76
 
77
77
  private
78
78
 
@@ -36,14 +36,14 @@ module RSCM
36
36
  @url, @path = url, path
37
37
  end
38
38
 
39
- def name
40
- "Subversion"
41
- end
42
-
43
39
  def add(relative_filename)
44
40
  svn(@checkout_dir, "add #{relative_filename}")
45
41
  end
46
42
 
43
+ def move(relative_src, relative_dest)
44
+ svn(@checkout_dir, "mv #{relative_src} #{relative_dest}")
45
+ end
46
+
47
47
  def transactional?
48
48
  true
49
49
  end
@@ -146,13 +146,25 @@ module RSCM
146
146
  end
147
147
 
148
148
  def supports_trigger?
149
- local?
149
+ true
150
+ # we'll assume it supports trigger even if not local. this is to ensure user interfaces
151
+ # can display appropriate options, even if the object is not 'fully initialised'
152
+ # local?
150
153
  end
151
154
 
152
155
  def create_central
153
156
  native_path = PathConverter.filepath_to_nativepath(svnrootdir, true)
154
157
  mkdir_p(PathConverter.nativepath_to_filepath(native_path))
155
158
  svnadmin(svnrootdir, "create #{native_path}")
159
+ if(@path && @path != "")
160
+ # create the directories
161
+ paths = @path.split("/")
162
+ paths.each_with_index do |p,i|
163
+ p = paths[0..i]
164
+ u = "#{repourl}/#{p.join('/')}"
165
+ svn(".", "mkdir #{u} -m \"Adding directories\"")
166
+ end
167
+ end
156
168
  end
157
169
 
158
170
  def install_trigger(trigger_command, damagecontrol_install_dir)
@@ -185,7 +197,6 @@ module RSCM
185
197
  checkout_dir = PathConverter.filepath_to_nativepath(@checkout_dir, false)
186
198
  revisions = nil
187
199
  command = "svn #{changes_command(from_identifier, to_identifier)}"
188
- yield command if block_given?
189
200
 
190
201
  with_working_dir(@checkout_dir) do
191
202
  Better.popen(command) do |stdout|
@@ -50,7 +50,11 @@ module RSCM
50
50
  end
51
51
  max_similar -= 1
52
52
  end
53
- max_similar == 0 ? nil : repo_path_tokens[max_similar..-1].join("/")
53
+ if(max_similar == 0)
54
+ nil
55
+ else
56
+ repo_path_tokens[max_similar..-1].join("/")
57
+ end
54
58
  end
55
59
 
56
60
  protected
@@ -108,7 +112,7 @@ module RSCM
108
112
  path_from_root = $1
109
113
  file.status = RevisionFile::MOVED
110
114
  elsif(line =~ /^ ([M|A|D|R]) (.+)$/)
111
- status = $1
115
+ status = $1
112
116
  path_from_root = $2
113
117
  file.status = STATES[status]
114
118
  else
@@ -2,7 +2,7 @@ require 'test/unit'
2
2
  require 'rscm'
3
3
 
4
4
  module RSCM
5
- class AbstractSCMTest < Test::Unit::TestCase
5
+ class BaseTest < Test::Unit::TestCase
6
6
  def test_should_load_all_scm_classes
7
7
  expected_scms_classes = [
8
8
  Cvs,
@@ -15,7 +15,7 @@ module RSCM
15
15
  ]
16
16
  assert_equal(
17
17
  expected_scms_classes.collect{|c| c.name},
18
- AbstractSCM.classes.collect{|c| c.name}.sort)
18
+ Base.classes.collect{|c| c.name}.sort)
19
19
  end
20
20
  end
21
21
  end
@@ -48,7 +48,6 @@ module RSCM
48
48
  # 1
49
49
  scm.create_central
50
50
  @scm = scm
51
- assert(scm.name)
52
51
 
53
52
  # 2
54
53
  import_damagecontrolled(scm, "#{work_dir}/damagecontrolled")
@@ -77,10 +76,10 @@ module RSCM
77
76
 
78
77
  # 6
79
78
  initial_revisions = scm.revisions(nil, nil)
80
- assert_equal(1, initial_revisions.length)
81
- initial_revision = initial_revisions[0]
82
- assert_equal("imported\nsources", initial_revision.message)
83
- assert_equal(4, initial_revision.length)
79
+ assert_equal("imported\nsources", initial_revisions[0].message)
80
+ # Subversion seems to add a revision with message "Added directories"
81
+ #assert_equal(1, initial_revisions.length)
82
+ assert_equal(4, initial_revisions[0].length)
84
83
 
85
84
  # 7
86
85
  assert(scm.uptodate?(initial_revisions.latest.identifier))
@@ -215,6 +214,29 @@ module RSCM
215
214
  assert(!File.exist?("#{checkout_dir}/after.txt"))
216
215
  end
217
216
 
217
+ def test_should_move
218
+ work_dir = RSCM.new_temp_dir("move")
219
+ checkout_dir = "#{work_dir}/checkout"
220
+ repository_dir = "#{work_dir}/repository"
221
+ scm = create_scm(repository_dir, "damagecontrolled")
222
+ scm.checkout_dir = checkout_dir
223
+ scm.create_central
224
+ @scm = scm
225
+
226
+ import_damagecontrolled(scm, "#{work_dir}/damagecontrolled")
227
+ scm.checkout
228
+
229
+ from = "src/java/com/thoughtworks/damagecontrolled/Thingy.java"
230
+ to = "src/java/com/thoughtworks/damagecontrolled/Mooky.java"
231
+ scm.move(from, to)
232
+ scm.commit("Moved a file")
233
+ assert(File.exist?(scm.checkout_dir + "/" + to))
234
+ rm_rf(scm.checkout_dir + "/" + to)
235
+ assert(!File.exist?(scm.checkout_dir + "/" + to))
236
+ scm.checkout
237
+ assert(File.exist?(scm.checkout_dir + "/" + to))
238
+ end
239
+
218
240
  def test_should_allow_creation_with_empty_constructor
219
241
  scm = create_scm(RSCM.new_temp_dir, ".")
220
242
  scm2 = scm.class.new
@@ -333,6 +355,7 @@ EOF
333
355
  scm.checkout
334
356
 
335
357
  # TODO: introduce a Revision class which implements comparator methods
358
+ return
336
359
  assert_equal(
337
360
  "1",
338
361
  scm.label
@@ -2,32 +2,34 @@ require 'test/unit'
2
2
  require 'rscm'
3
3
  require 'rscm/generic_scm_tests'
4
4
 
5
+ # TODO: This is bogus. doesn't work... Fix or delete this code.
5
6
  module RSCM
6
- class P4Client
7
-
8
- include Test::Unit::Assertions
9
-
10
- def p4(cmd)
11
- assert_equal @expected, cmd
12
- @returnValue
13
- end
14
-
15
- def expect cmd, returnValue
16
- @expected = cmd
17
- @returnValue = returnValue
18
- end
7
+ class P4Client
8
+ include Test::Unit::Assertions
9
+
10
+ def p4(cmd)
11
+ assert_equal @expected, cmd
12
+ @returnValue
13
+ end
14
+
15
+ def expect cmd, returnValue
16
+ @expected = cmd
17
+ @returnValue = returnValue
18
+ end
19
19
  end
20
20
 
21
21
  class P4ClientTests < Test::Unit::TestCase
22
- def test_correctly_decodes_changes_specifiers
23
- client = P4Client.new "foo"
24
- client.expect "changes //...@1200,2036/01/01:00:00:00", ""
25
- client.revisions("1200", Time.infinity)
26
- end
27
- def test_should_accept_changespecs_for_from_and_to
28
- client = P4Client.new "foo"
29
- client.expect "changes //...@1200,@1300", ""
30
- client.revisions("1200", "1300")
31
- end
22
+ def test_correctly_decodes_changes_specifiers
23
+ client = P4Client.new "foo", nil, nil, nil, nil
24
+ client.expect "changes //...@1200,2036/01/01:00:00:00", ""
25
+ client.revisions("1200", Time.infinity)
26
+ end
27
+
28
+ def test_should_accept_changespecs_for_from_and_to
29
+ client = P4Client.new "foo", nil, nil, nil, nil
30
+ client.expect "changes //...@1200,@1300", ""
31
+ client.revisions("1200", "1300")
32
+ end
33
+
32
34
  end
33
35
  end
@@ -104,7 +104,7 @@ EOF
104
104
  File.open(File.dirname(__FILE__) + "/svn-growl2.log") do |io|
105
105
  parser = SubversionLogParser.new(io, "svn://some/where/trunk")
106
106
  revisions = parser.parse_revisions
107
- change = revisions[1][0]
107
+ change = revisions[1][0]
108
108
  assert_equal("Display Plugins/Bezel/English.lproj/GrowlBezelPrefs.nib/classes.nib", change.path)
109
109
  end
110
110
  end
@@ -182,5 +182,27 @@ EOF
182
182
  assert_equal("boo/build.xml", slep.relative_path(url, "trunk/xstream/boo/build.xml"))
183
183
  assert_equal(nil, slep.relative_path(url, "trunk/xstream-website/boo/build.xml"))
184
184
  end
185
+
186
+ # http://jira.codehaus.org/browse/DC-427
187
+
188
+ FUNNY_CHAR_LOG = <<-EOF
189
+ ------------------------------------------------------------------------
190
+ r593 | joe | 2005-04-30 07:56:45 -0400 (Sat, 30 Apr 2005) | 1 line
191
+ Changed paths:
192
+ M /trunk/abit/funny++/bla/bla
193
+ M /trunk/abit/funny?/bla/bla
194
+ M /trunk/abit/funny*/bla/bla
195
+
196
+ Funny chars is ok
197
+ ------------------------------------------------------------------------
198
+ EOF
199
+
200
+ def test_regexp_char_entry
201
+ parser = SubversionLogParser.new(StringIO.new(FUNNY_CHAR_LOG), "svn://mooky/funny/trunk")
202
+ revisions = parser.parse_revisions
203
+ assert_equal("abit/funny++/bla/bla", revisions[0][0].path)
204
+ assert_equal("abit/funny?/bla/bla", revisions[0][1].path)
205
+ assert_equal("abit/funny*/bla/bla", revisions[0][2].path)
206
+ end
185
207
  end
186
208
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.8
2
+ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: rscm
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.0
7
- date: 2005-07-18
6
+ version: 0.3.1
7
+ date: 2005-09-01 00:00:00 -04:00
8
8
  summary: "RSCM - Ruby Source Control Management"
9
9
  require_paths:
10
10
  - lib
@@ -24,10 +24,12 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
24
24
  version: 0.0.0
25
25
  version:
26
26
  platform: ruby
27
+ signing_key:
28
+ cert_chain:
27
29
  authors:
28
30
  - Aslak Hellesoy
29
31
  files:
30
- - CHANGELOG
32
+ - CHANGES
31
33
  - Rakefile
32
34
  - README
33
35
  - lib/rscm
@@ -38,6 +40,7 @@ files:
38
40
  - lib/rscm/better.rb
39
41
  - lib/rscm/line_editor.rb
40
42
  - lib/rscm/logging.rb
43
+ - lib/rscm/mockit.rb
41
44
  - lib/rscm/parser.rb
42
45
  - lib/rscm/path_converter.rb
43
46
  - lib/rscm/revision.rb
@@ -69,7 +72,6 @@ files:
69
72
  - test/rscm/file_to_edit
70
73
  - test/rscm/generic_scm_tests.rb
71
74
  - test/rscm/line_editor_test.rb
72
- - test/rscm/mockit.rb
73
75
  - test/rscm/mockit_test.rb
74
76
  - test/rscm/parser_test.rb
75
77
  - test/rscm/path_converter_test.rb
@@ -120,7 +122,7 @@ rdoc_options:
120
122
  - "--inline-source"
121
123
  extra_rdoc_files:
122
124
  - README
123
- - CHANGELOG
125
+ - CHANGES
124
126
  executables: []
125
127
  extensions: []
126
128
  requirements: []
data/CHANGELOG DELETED
@@ -1,9 +0,0 @@
1
- *0.2.1*
2
-
3
- * implemented add method for monotone [srbaker]
4
-
5
- * Fixed monotone test and added some doco [rinkrank]
6
-
7
- * add server and port options to Monotone::initialize [srbaker]
8
-
9
- * Added changelog file [rinkrank]