summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/repository/cvs.rb11
-rw-r--r--test/unit/repository_cvs_test.rb5
2 files changed, 13 insertions, 3 deletions
diff --git a/app/models/repository/cvs.rb b/app/models/repository/cvs.rb
index 8ea4f2301..dbbb4694f 100644
--- a/app/models/repository/cvs.rb
+++ b/app/models/repository/cvs.rb
@@ -104,10 +104,11 @@ class Repository::Cvs < Repository
scm.revisions('', fetch_since, nil, :with_paths => true) do |revision|
# only add the change to the database, if it doen't exists. the cvs log
# is not exclusive at all.
+ tmp_time = revision.time.clone
unless changes.find_by_path_and_revision(
scm.with_leading_slash(revision.paths[0][:path]), revision.paths[0][:revision])
cs = changesets.find(:first, :conditions=>{
- :committed_on=>revision.time-time_delta..revision.time+time_delta,
+ :committed_on=>tmp_time - time_delta .. tmp_time + time_delta,
:committer=>revision.author,
:comments=>Changeset.normalize_comments(revision.message)
})
@@ -116,10 +117,14 @@ class Repository::Cvs < Repository
unless cs
# we use a temporaray revision number here (just for inserting)
# later on, we calculate a continous positive number
+ tmp_time2 = tmp_time.clone.gmtime
+ branch = revision.paths[0][:branch]
+ scmid = branch + "-" + tmp_time2.strftime("%Y%m%d-%H%M%S")
cs = Changeset.create(:repository => self,
- :revision => "tmp#{tmp_rev_num}",
+ :revision => "tmp#{tmp_rev_num}",
+ :scmid => scmid,
:committer => revision.author,
- :committed_on => revision.time,
+ :committed_on => tmp_time,
:comments => revision.message)
tmp_rev_num += 1
end
diff --git a/test/unit/repository_cvs_test.rb b/test/unit/repository_cvs_test.rb
index e7b247ab4..a5da09f55 100644
--- a/test/unit/repository_cvs_test.rb
+++ b/test/unit/repository_cvs_test.rb
@@ -42,6 +42,9 @@ class RepositoryCvsTest < ActiveSupport::TestCase
assert_equal 5, @repository.changesets.count
assert_equal 14, @repository.changes.count
assert_not_nil @repository.changesets.find_by_comments('Two files changed')
+
+ r2 = @repository.changesets.find_by_revision('2')
+ assert_equal 'v1-20071213-162510', r2.scmid
end
def test_fetch_changesets_incremental
@@ -57,6 +60,7 @@ class RepositoryCvsTest < ActiveSupport::TestCase
assert_equal '3', rev3_commit.revision
# 2007-12-14 01:27:22 +0900
rev3_committed_on = Time.gm(2007, 12, 13, 16, 27, 22)
+ assert_equal 'HEAD-20071213-162722', rev3_commit.scmid
assert_equal rev3_committed_on, rev3_commit.committed_on
latest_rev = @repository.latest_changeset
assert_equal rev3_committed_on, latest_rev.committed_on
@@ -67,6 +71,7 @@ class RepositoryCvsTest < ActiveSupport::TestCase
assert_equal %w|5 4 3 2 1|, @repository.changesets.collect(&:revision)
rev5_commit = @repository.changesets.find(:first, :order => 'committed_on DESC')
+ assert_equal 'HEAD-20071213-163001', rev5_commit.scmid
# 2007-12-14 01:30:01 +0900
rev5_committed_on = Time.gm(2007, 12, 13, 16, 30, 1)
assert_equal rev5_committed_on, rev5_commit.committed_on