|
@@
-24,7
+24,8
class RepositoryCvsTest < ActiveSupport::TestCase
|
|
24
|
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/cvs_repository'
|
|
24
|
REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/cvs_repository'
|
|
25
|
REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
|
|
25
|
REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
|
|
26
|
# CVS module
|
|
26
|
# CVS module
|
|
27
|
MODULE_NAME = 'test'
|
|
27
|
MODULE_NAME = 'test'
|
|
|
|
|
28
|
CHANGESETS_NUM = 7
|
|
28
|
|
|
29
|
|
|
29
|
def setup
|
|
30
|
def setup
|
|
30
|
@project = Project.find(3)
|
|
31
|
@project = Project.find(3)
|
|
@@
-41,8
+42,8
class RepositoryCvsTest < ActiveSupport::TestCase
|
|
41
|
@repository.fetch_changesets
|
|
42
|
@repository.fetch_changesets
|
|
42
|
@repository.reload
|
|
43
|
@repository.reload
|
|
43
|
|
|
44
|
|
|
44
|
assert_equal 5, @repository.changesets.count
|
|
45
|
assert_equal CHANGESETS_NUM, @repository.changesets.count
|
|
45
|
assert_equal 14, @repository.changes.count
|
|
46
|
assert_equal 16, @repository.changes.count
|
|
46
|
assert_not_nil @repository.changesets.find_by_comments('Two files changed')
|
|
47
|
assert_not_nil @repository.changesets.find_by_comments('Two files changed')
|
|
47
|
|
|
48
|
|
|
48
|
r2 = @repository.changesets.find_by_revision('2')
|
|
49
|
r2 = @repository.changesets.find_by_revision('2')
|
|
@@
-69,10
+70,10
class RepositoryCvsTest < ActiveSupport::TestCase
|
|
69
|
|
|
70
|
|
|
70
|
@repository.fetch_changesets
|
|
71
|
@repository.fetch_changesets
|
|
71
|
@repository.reload
|
|
72
|
@repository.reload
|
|
72
|
assert_equal 5, @repository.changesets.count
|
|
73
|
assert_equal CHANGESETS_NUM, @repository.changesets.count
|
|
73
|
|
|
74
|
|
|
74
|
assert_equal %w|5 4 3 2 1|, @repository.changesets.collect(&:revision)
|
|
75
|
assert_equal %w|7 6 5 4 3 2 1|, @repository.changesets.collect(&:revision)
|
|
75
|
rev5_commit = @repository.changesets.find(:first, :order => 'committed_on DESC')
|
|
76
|
rev5_commit = @repository.changesets.find_by_revision('5')
|
|
76
|
assert_equal 'HEAD-20071213-163001', rev5_commit.scmid
|
|
77
|
assert_equal 'HEAD-20071213-163001', rev5_commit.scmid
|
|
77
|
# 2007-12-14 01:30:01 +0900
|
|
78
|
# 2007-12-14 01:30:01 +0900
|
|
78
|
rev5_committed_on = Time.gm(2007, 12, 13, 16, 30, 1)
|
|
79
|
rev5_committed_on = Time.gm(2007, 12, 13, 16, 30, 1)
|
|
@@
-83,7
+84,7
class RepositoryCvsTest < ActiveSupport::TestCase
|
|
83
|
assert_equal 0, @repository.changesets.count
|
|
84
|
assert_equal 0, @repository.changesets.count
|
|
84
|
@repository.fetch_changesets
|
|
85
|
@repository.fetch_changesets
|
|
85
|
@repository.reload
|
|
86
|
@repository.reload
|
|
86
|
assert_equal 5, @repository.changesets.count
|
|
87
|
assert_equal CHANGESETS_NUM, @repository.changesets.count
|
|
87
|
|
|
88
|
|
|
88
|
entries = @repository.entries('sources')
|
|
89
|
entries = @repository.entries('sources')
|
|
89
|
assert entries.detect {|e| e.name == 'watchers_controller.rb'}
|
|
90
|
assert entries.detect {|e| e.name == 'watchers_controller.rb'}
|
|
@@
-121,7
+122,7
class RepositoryCvsTest < ActiveSupport::TestCase
|
|
121
|
buf = @repository.cat('README')
|
|
122
|
buf = @repository.cat('README')
|
|
122
|
assert buf
|
|
123
|
assert buf
|
|
123
|
lines = buf.split("\n")
|
|
124
|
lines = buf.split("\n")
|
|
124
|
assert_equal 2, lines.length
|
|
125
|
assert_equal 3, lines.length
|
|
125
|
buf = lines[1].gsub(/\r$/, "")
|
|
126
|
buf = lines[1].gsub(/\r$/, "")
|
|
126
|
assert_equal 'with one change', buf
|
|
127
|
assert_equal 'with one change', buf
|
|
127
|
buf = @repository.cat('README', '1')
|
|
128
|
buf = @repository.cat('README', '1')
|
|
@@
-145,7
+146,7
class RepositoryCvsTest < ActiveSupport::TestCase
|
|
145
|
@repository.reload
|
|
146
|
@repository.reload
|
|
146
|
ann = @repository.annotate('README')
|
|
147
|
ann = @repository.annotate('README')
|
|
147
|
assert ann
|
|
148
|
assert ann
|
|
148
|
assert_equal 2, ann.revisions.length
|
|
149
|
assert_equal 3, ann.revisions.length
|
|
149
|
assert_equal '1.2', ann.revisions[1].revision
|
|
150
|
assert_equal '1.2', ann.revisions[1].revision
|
|
150
|
assert_equal 'LANG', ann.revisions[1].author
|
|
151
|
assert_equal 'LANG', ann.revisions[1].author
|
|
151
|
assert_equal 'with one change', ann.lines[1]
|
|
152
|
assert_equal 'with one change', ann.lines[1]
|