@@ -104,10 +104,11 class Repository::Cvs < Repository | |||
|
104 | 104 | scm.revisions('', fetch_since, nil, :with_paths => true) do |revision| |
|
105 | 105 | # only add the change to the database, if it doen't exists. the cvs log |
|
106 | 106 | # is not exclusive at all. |
|
107 | tmp_time = revision.time.clone | |
|
107 | 108 | unless changes.find_by_path_and_revision( |
|
108 | 109 | scm.with_leading_slash(revision.paths[0][:path]), revision.paths[0][:revision]) |
|
109 | 110 | cs = changesets.find(:first, :conditions=>{ |
|
110 |
:committed_on=> |
|
|
111 | :committed_on=>tmp_time - time_delta .. tmp_time + time_delta, | |
|
111 | 112 | :committer=>revision.author, |
|
112 | 113 | :comments=>Changeset.normalize_comments(revision.message) |
|
113 | 114 | }) |
@@ -116,10 +117,14 class Repository::Cvs < Repository | |||
|
116 | 117 | unless cs |
|
117 | 118 | # we use a temporaray revision number here (just for inserting) |
|
118 | 119 | # later on, we calculate a continous positive number |
|
120 | tmp_time2 = tmp_time.clone.gmtime | |
|
121 | branch = revision.paths[0][:branch] | |
|
122 | scmid = branch + "-" + tmp_time2.strftime("%Y%m%d-%H%M%S") | |
|
119 | 123 | cs = Changeset.create(:repository => self, |
|
120 |
:revision => "tmp#{tmp_rev_num}", |
|
|
124 | :revision => "tmp#{tmp_rev_num}", | |
|
125 | :scmid => scmid, | |
|
121 | 126 | :committer => revision.author, |
|
122 |
:committed_on => |
|
|
127 | :committed_on => tmp_time, | |
|
123 | 128 | :comments => revision.message) |
|
124 | 129 | tmp_rev_num += 1 |
|
125 | 130 | end |
@@ -42,6 +42,9 class RepositoryCvsTest < ActiveSupport::TestCase | |||
|
42 | 42 | assert_equal 5, @repository.changesets.count |
|
43 | 43 | assert_equal 14, @repository.changes.count |
|
44 | 44 | assert_not_nil @repository.changesets.find_by_comments('Two files changed') |
|
45 | ||
|
46 | r2 = @repository.changesets.find_by_revision('2') | |
|
47 | assert_equal 'v1-20071213-162510', r2.scmid | |
|
45 | 48 | end |
|
46 | 49 | |
|
47 | 50 | def test_fetch_changesets_incremental |
@@ -57,6 +60,7 class RepositoryCvsTest < ActiveSupport::TestCase | |||
|
57 | 60 | assert_equal '3', rev3_commit.revision |
|
58 | 61 | # 2007-12-14 01:27:22 +0900 |
|
59 | 62 | rev3_committed_on = Time.gm(2007, 12, 13, 16, 27, 22) |
|
63 | assert_equal 'HEAD-20071213-162722', rev3_commit.scmid | |
|
60 | 64 | assert_equal rev3_committed_on, rev3_commit.committed_on |
|
61 | 65 | latest_rev = @repository.latest_changeset |
|
62 | 66 | assert_equal rev3_committed_on, latest_rev.committed_on |
@@ -67,6 +71,7 class RepositoryCvsTest < ActiveSupport::TestCase | |||
|
67 | 71 | |
|
68 | 72 | assert_equal %w|5 4 3 2 1|, @repository.changesets.collect(&:revision) |
|
69 | 73 | rev5_commit = @repository.changesets.find(:first, :order => 'committed_on DESC') |
|
74 | assert_equal 'HEAD-20071213-163001', rev5_commit.scmid | |
|
70 | 75 | # 2007-12-14 01:30:01 +0900 |
|
71 | 76 | rev5_committed_on = Time.gm(2007, 12, 13, 16, 30, 1) |
|
72 | 77 | assert_equal rev5_committed_on, rev5_commit.committed_on |
General Comments 0
You need to be logged in to leave comments.
Login now