rscm 0.4.5 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/CHANGES +12 -0
  2. data/README +14 -0
  3. data/Rakefile +4 -24
  4. data/lib/rscm.rb +1 -2
  5. data/lib/rscm/base.rb +289 -281
  6. data/lib/rscm/command_line.rb +135 -112
  7. data/lib/rscm/revision.rb +63 -166
  8. data/lib/rscm/revision_file.rb +8 -2
  9. data/lib/rscm/revision_poller.rb +78 -67
  10. data/lib/rscm/revisions.rb +79 -0
  11. data/lib/rscm/scm/clearcase.rb +11 -9
  12. data/lib/rscm/scm/cvs.rb +374 -352
  13. data/lib/rscm/scm/cvs_log_parser.rb +1 -0
  14. data/lib/rscm/scm/darcs.rb +9 -0
  15. data/lib/rscm/scm/perforce.rb +216 -149
  16. data/lib/rscm/scm/subversion.rb +44 -24
  17. data/lib/rscm/scm/subversion_log_parser.rb +37 -51
  18. data/lib/rscm/time_ext.rb +0 -1
  19. data/lib/rscm/version.rb +2 -2
  20. data/test/rscm/command_line_test.rb +7 -5
  21. data/test/rscm/compatibility/config.yml +4 -4
  22. data/test/rscm/compatibility/cvs_metaproject/diff.txt +52 -0
  23. data/test/rscm/compatibility/cvs_metaproject/file.txt +48 -0
  24. data/test/rscm/compatibility/cvs_metaproject/old.yml +13 -0
  25. data/test/rscm/compatibility/full.rb +2 -223
  26. data/test/rscm/compatibility/p4_gfx/files_0.yml +10 -0
  27. data/test/rscm/compatibility/p4_gfx/old.yml +26 -0
  28. data/test/rscm/compatibility/p4_gfx/revisions.yml +24 -0
  29. data/test/rscm/compatibility/p4_gfx/scm.yml +4 -0
  30. data/test/rscm/compatibility/rscm_engine.rb +197 -0
  31. data/test/rscm/compatibility/subversion_rscm/diff.txt +12 -0
  32. data/test/rscm/compatibility/subversion_rscm/file.txt +567 -0
  33. data/test/rscm/compatibility/subversion_rscm/old.yml +14 -0
  34. data/test/rscm/compatibility/subversion_rscm/revisions.yml +17 -0
  35. data/test/rscm/compatibility/subversion_rscm/scm.yml +1 -0
  36. data/test/rscm/revision_file_test.rb +10 -0
  37. data/test/rscm/revision_poller_test.rb +91 -0
  38. data/test/rscm/revision_test.rb +22 -117
  39. data/test/rscm/revisions_test.rb +80 -0
  40. data/test/rscm/scm/cvs_log_parser_test.rb +569 -567
  41. data/test/rscm/scm/cvs_test.rb +6 -3
  42. data/test/rscm/scm/darcs_test.rb +4 -7
  43. data/test/rscm/scm/perforce_test.rb +6 -2
  44. data/test/rscm/scm/star_team_test.rb +10 -0
  45. data/test/rscm/scm/subversion_log_parser_test.rb +38 -5
  46. data/test/rscm/scm/subversion_test.rb +2 -3
  47. data/test/rscm/test_helper.rb +41 -2
  48. data/testproject/damagecontrolled/build.xml +154 -154
  49. data/testproject/damagecontrolled/src/java/com/thoughtworks/damagecontrolled/Thingy.java +6 -6
  50. metadata +19 -7
  51. data/lib/rscm/historic_file.rb +0 -30
  52. data/test/rscm/compatibility/damage_control_minimal.rb +0 -104
  53. data/test/rscm/revision_fixture.rb +0 -20
  54. data/test/rscm/revisions.yaml +0 -42
  55. data/test/rscm/scm/star_team.rb +0 -36
@@ -1,7 +1,7 @@
1
- package com.thoughtworks.damagecontrolled;
2
-
3
- public class Thingy {
4
- public String getBeer() {
5
- return "Duvel";
6
- }
1
+ package com.thoughtworks.damagecontrolled;
2
+
3
+ public class Thingy {
4
+ public String getBeer() {
5
+ return "Duvel";
6
+ }
7
7
  }
metadata CHANGED
@@ -3,8 +3,8 @@ 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.5
7
- date: 2006-03-06 00:00:00 -06:00
6
+ version: 0.5.0
7
+ date: 2006-05-18 00:00:00 -05:00
8
8
  summary: RSCM - Ruby Source Control Management
9
9
  require_paths:
10
10
  - lib
@@ -37,13 +37,13 @@ files:
37
37
  - lib/rscm/base.rb
38
38
  - lib/rscm/command_line.rb
39
39
  - lib/rscm/difftool.rb
40
- - lib/rscm/historic_file.rb
41
40
  - lib/rscm/line_editor.rb
42
41
  - lib/rscm/mockit.rb
43
42
  - lib/rscm/parser.rb
44
43
  - lib/rscm/path_converter.rb
45
44
  - lib/rscm/platform.rb
46
45
  - lib/rscm/revision.rb
46
+ - lib/rscm/revisions.rb
47
47
  - lib/rscm/revision_file.rb
48
48
  - lib/rscm/revision_poller.rb
49
49
  - lib/rscm/scm
@@ -77,20 +77,32 @@ files:
77
77
  - test/rscm/mockit_test.rb
78
78
  - test/rscm/parser_test.rb
79
79
  - test/rscm/path_converter_test.rb
80
- - test/rscm/revision_fixture.rb
80
+ - test/rscm/revisions_test.rb
81
+ - test/rscm/revision_file_test.rb
82
+ - test/rscm/revision_poller_test.rb
81
83
  - test/rscm/revision_test.rb
82
- - test/rscm/revisions.yaml
83
84
  - test/rscm/scm
84
85
  - test/rscm/test_helper.rb
85
86
  - test/rscm/compatibility/config.yml
86
87
  - test/rscm/compatibility/cvs_metaproject
87
- - test/rscm/compatibility/damage_control_minimal.rb
88
88
  - test/rscm/compatibility/full.rb
89
+ - test/rscm/compatibility/p4_gfx
90
+ - test/rscm/compatibility/rscm_engine.rb
89
91
  - test/rscm/compatibility/subversion_rscm
92
+ - test/rscm/compatibility/cvs_metaproject/diff.txt
93
+ - test/rscm/compatibility/cvs_metaproject/file.txt
90
94
  - test/rscm/compatibility/cvs_metaproject/files_0.yml
95
+ - test/rscm/compatibility/cvs_metaproject/old.yml
91
96
  - test/rscm/compatibility/cvs_metaproject/revisions.yml
92
97
  - test/rscm/compatibility/cvs_metaproject/scm.yml
98
+ - test/rscm/compatibility/p4_gfx/files_0.yml
99
+ - test/rscm/compatibility/p4_gfx/old.yml
100
+ - test/rscm/compatibility/p4_gfx/revisions.yml
101
+ - test/rscm/compatibility/p4_gfx/scm.yml
102
+ - test/rscm/compatibility/subversion_rscm/diff.txt
103
+ - test/rscm/compatibility/subversion_rscm/file.txt
93
104
  - test/rscm/compatibility/subversion_rscm/files_0.yml
105
+ - test/rscm/compatibility/subversion_rscm/old.yml
94
106
  - test/rscm/compatibility/subversion_rscm/revisions.yml
95
107
  - test/rscm/compatibility/subversion_rscm/scm.yml
96
108
  - test/rscm/compatibility/subversion_rscm/svn_log_bug_irc.txt
@@ -106,7 +118,7 @@ files:
106
118
  - test/rscm/scm/mooky_test.rb
107
119
  - test/rscm/scm/p4client_test.rb
108
120
  - test/rscm/scm/perforce_test.rb
109
- - test/rscm/scm/star_team.rb
121
+ - test/rscm/scm/star_team_test.rb
110
122
  - test/rscm/scm/subversion_log_parser_test.rb
111
123
  - test/rscm/scm/subversion_test.rb
112
124
  - test/rscm/scm/svn-cargo.log
@@ -1,30 +0,0 @@
1
- module RSCM
2
- # Represents the full history of a single file or directory.
3
- class HistoricFile
4
- attr_reader :relative_path
5
-
6
- def initialize(relative_path, directory, scm)
7
- raise "Not a String: '#{relative_path}' (#{relative_path.class.name})" unless relative_path.is_a? String
8
- @relative_path, @directory, @scm = relative_path, directory, scm
9
- end
10
-
11
- def directory?
12
- @directory
13
- end
14
-
15
- # Returns an Array of RevisionFile - from Time.epoch until Time.infinity (now)
16
- def revision_files(options={})
17
- @scm.revisions(Time.epoch, options.dup.merge({:to_identifier => Time.infinity, :relative_path => @relative_path})).collect do |revision|
18
- if revision.files.length != 1
19
- files_s = revision.files.collect{|f| f.to_s}.join("\n")
20
- raise "The file-specific revision didn't have exactly one file, but #{revision.files.length}:\n#{files_s}"
21
- end
22
- if(!revision.files[0].path.eql?(@relative_path))
23
- raise "The file-specific revision didn't have expected path '#{@relative_path}', but '#{revision.files[0].path}'"
24
- end
25
- revision.files[0]
26
- end
27
- end
28
-
29
- end
30
- end
@@ -1,104 +0,0 @@
1
- module RSCM
2
- module Compatibility
3
- # These tests verify that an RSCM adapter implements
4
- # the API that is required in order to use the adapter with DamageControl
5
- module DamageControlMinimal
6
- include Difftool
7
-
8
- def setup
9
- config_yml = File.dirname(__FILE__) + '/config.yml'
10
- config = YAML::load_file(config_yml)
11
- raise "#{config_yml} must have an entry for #{self.class.name}" if config[self.class.name].nil?
12
- @testdata_dir = File.dirname(__FILE__) + '/' + config[self.class.name]
13
- raise "#{@testdata_dir} directory doesn't exist" unless File.directory?(@testdata_dir)
14
- @scm = YAML::load_file(@testdata_dir + '/scm.yml')
15
- end
16
-
17
- def test_should_get_revisions_by_revision_identifier
18
- suffix = method_name
19
- do_verify_revisions_by_property(suffix, :identifier)
20
- end
21
-
22
- def test_should_get_revisions_by_time
23
- # Subversion 1.3.0 currently has an unresolved bug:
24
- # http://subversion.tigris.org/issues/show_bug.cgi?id=1642
25
- #
26
- # svn log http://buildpatterns.com/svn/repos/rscm/trunk/test/ --revision {"2006-03-03 11:55:55"}:{"2006-03-03 18:24:08"}
27
- #
28
- # returns revisions outside the lower bounds.
29
- # we therefore exclude this test when running svn tests - it's not that important since DC only uses timestamps
30
- # on the first run for a project, and it's not important that it is accurate.
31
- unless self.class.name == 'RSCM::SubversionTest'
32
- suffix = method_name
33
- do_verify_revisions_by_property(suffix, :time)
34
- end
35
- end
36
-
37
- def do_verify_revisions_by_property(suffix, something)
38
- dir = File.expand_path(RSCM.new_temp_dir(suffix))
39
- options = {:stdout => "#{dir}/stdout.log", :stderr => "#{dir}/stderr.log"}.freeze
40
- @scm.checkout_dir = "#{dir}/checkout"
41
-
42
- expected_yaml = @testdata_dir + '/revisions.yml'
43
- expected = YAML::load_file(expected_yaml)
44
- opts = options.dup.merge :to_identifier => expected.last.send(something)
45
- actual = @scm.revisions(expected.first.send(something)-1, opts)
46
-
47
- if(expected != actual)
48
- assert_equal_with_diff(expected_yaml, actual.to_yaml, "See logs in #{dir}")
49
- end
50
-
51
- opts = options.dup.merge :to_identifier => expected.last.send(something)
52
- later = @scm.revisions(expected.first.send(something), opts)
53
- assert_not_equal(expected, later)
54
-
55
- opts = options.dup.merge :to_identifier => expected.last.send(something)
56
- earlier = @scm.revisions(expected.first.send(something)+1, opts)
57
- assert_not_equal(expected, earlier)
58
- end
59
-
60
- def test_should_checkout_sources_to_particular_revision
61
- dirname = method_name
62
- dir = File.expand_path(RSCM.new_temp_dir(dirname))
63
- options = {:stdout => "#{dir}/stdout.log", :stderr => "#{dir}/stderr.log"}.freeze
64
- revisions_yml = @testdata_dir + '/revisions.yml'
65
- revisions = YAML::load_file(revisions_yml)
66
- @scm.checkout_dir = RSCM.new_temp_dir("#{dirname}_0")
67
- files_0 = @scm.checkout(revisions[0].identifier, options)
68
- expected_yaml = @testdata_dir + "/files_0.yml"
69
- expected = YAML::load_file(expected_yaml)
70
- if(expected != files_0)
71
- assert_equal_with_diff(expected_yaml, files_0.to_yaml)
72
- end
73
-
74
- # We can predict what the next checked out files should be
75
- expected_files = files_0.dup
76
- revisions[1].each do |file|
77
- expected_files.delete(file.path) if file.status == "DELETED"
78
- expected_files.push(file.path) if file.status == "ADDED"
79
- end
80
- expected_files.sort!
81
- if(files_0 == expected_files)
82
- flunk "The 2nd revision in #{revisions_yml} must have at least one added or deleted file"
83
- end
84
-
85
- @scm.checkout_dir = RSCM.new_temp_dir("#{dirname}_1")
86
- files_1 = @scm.checkout(revisions[1].identifier, options)
87
- assert_equal(expected_files, files_1)
88
-
89
- # Now check out to the 1st revision again and verify files were removed
90
- added_paths = revisions[1].find_all{|rf| rf.status=="ADDED"}.collect{|rf| rf.path}
91
- assert added_paths.size > 0
92
- added_paths.each do |p|
93
- full_path = @scm.checkout_dir + '/' + p
94
- assert File.exist?(full_path), "Should exist: #{full_path}"
95
- end
96
- @scm.checkout(revisions[0].identifier, options)
97
- added_paths.each do |p|
98
- full_path = @scm.checkout_dir + '/' + p
99
- assert !File.exist?(full_path), "Should no longer exist: #{full_path}"
100
- end
101
- end
102
- end
103
- end
104
- end
@@ -1,20 +0,0 @@
1
- require 'test/unit'
2
- require 'rscm/revision'
3
-
4
- module RSCM
5
- module RevisionFixture
6
- def setup_changes
7
- #1
8
- @change1 = RSCM::RevisionFile.new("path/one", nil, "jon", "Fixed CATCH-22", nil, Time.utc(2004,7,5,12,0,2))
9
- @change2 = RSCM::RevisionFile.new("path/two", nil, "jon", "Fixed CATCH-22", nil, Time.utc(2004,7,5,12,0,4))
10
- #2
11
- @change3 = RSCM::RevisionFile.new("path/three", nil, "jon", "hipp hurra", nil, Time.utc(2004,7,5,12,0,6))
12
- #3
13
- @change4 = RSCM::RevisionFile.new("path/four", nil, "aslak", "hipp hurraX", nil, Time.utc(2004,7,5,12,0,8))
14
- #4
15
- @change5 = RSCM::RevisionFile.new("path/five", nil, "aslak", "hipp hurra", nil, Time.utc(2004,7,5,12,0,10))
16
- @change6 = RSCM::RevisionFile.new("path/six", nil, "aslak", "hipp hurra", nil, Time.utc(2004,7,5,12,0,12))
17
- @change7 = RSCM::RevisionFile.new("path/seven", nil, "aslak", "hipp hurra", nil, Time.utc(2004,7,5,12,0,14))
18
- end
19
- end
20
- end
@@ -1,42 +0,0 @@
1
- --- !ruby/object:RSCM::Revisions
2
- revisions:
3
- - !ruby/object:RSCM::Revision
4
- files:
5
- - !ruby/object:RSCM::RevisionFile
6
- developer: rinkrank
7
- message: "En to
8
-
9
- tre buksa
10
-
11
- ned
12
-
13
- "
14
- path: server/damagecontrol/web/AbstractAdminServlet.rb
15
- previous_native_revision_identifier: "1.42"
16
- native_revision_identifier: "1.43"
17
- status: MODIFIED
18
- time: 2004-11-30 04:52:24 Z
19
- - !ruby/object:RSCM::RevisionFile
20
- developer: rinkrank
21
- message: "En to
22
-
23
- tre buksa
24
-
25
- ned
26
-
27
- "
28
- path: server/damagecontrol/web/ProjectServlet.rb
29
- previous_native_revision_identifier: "1.71"
30
- native_revision_identifier: "1.72"
31
- status: MODIFIED
32
- time: 2004-11-30 04:53:23 Z
33
- developer: rinkrank
34
- message: "En to
35
-
36
- tre buksa
37
-
38
- ned
39
-
40
- "
41
- revision: MAIN:rinkrank:20041130045224
42
- time: 2004-11-30 04:52:24 Z
@@ -1,36 +0,0 @@
1
- require 'test/unit'
2
- require 'fileutils'
3
- require 'rscm'
4
- require 'rscm/generic_scm_tests'
5
-
6
- module RSCM
7
- class StarTeamTest < Test::Unit::TestCase
8
- # include GenericSCMTests
9
-
10
- def create_scm(repository_root_dir, path)
11
- StarTeam.new(ENV["STARTEAM_USER"], ENV["STARTEAM_PASS"], "192.168.254.21", 49201, "NGST Application", "NGST Application", "java")
12
- end
13
-
14
- def test_revisions
15
- from = Time.new - 2 * 3600 * 24
16
- to = Time.new - 1 * 3600 * 24
17
- puts "Getting revisions for #{from} - #{to}"
18
-
19
- revisions = create_scm(nil, nil).revisions(nil, from, to)
20
- assert_equal(1, revisions.length)
21
- assert_equal(Time.utc(2004, 11, 30, 04, 52, 24), revisions[0][0].time)
22
- assert_equal(Time.utc(2004, 11, 30, 04, 53, 23), revisions[0][1].time)
23
- assert_equal(Time.utc(2004, 11, 30, 04, 53, 23), revisions[0].time)
24
- assert_equal("rinkrank", revisions[0].developer)
25
- assert_equal("En to\ntre buksa \nned\n", revisions[0].message)
26
- end
27
-
28
- def test_checkout
29
- files = create_scm(nil, nil).checkout("target/starteam/checkout")
30
- assert_equal(3, files.length)
31
- assert_equal("eenie/meenie/minee/mo", files[0])
32
- assert_equal("catch/a/redneck/by", files[1])
33
- assert_equal("the/toe", files[2])
34
- end
35
- end
36
- end