@@ -45,20 +45,22 class Repository::Git < Repository | |||||
45 |
|
45 | |||
46 | unless changesets.find_by_scmid(scm_revision) |
|
46 | unless changesets.find_by_scmid(scm_revision) | |
47 | scm.revisions('', db_revision, nil, :reverse => true) do |revision| |
|
47 | scm.revisions('', db_revision, nil, :reverse => true) do |revision| | |
48 | transaction do |
|
48 | if changesets.find_by_scmid(revision.scmid.to_s).nil? | |
49 | changeset = Changeset.create(:repository => self, |
|
49 | transaction do | |
50 | :revision => revision.identifier, |
|
50 | changeset = Changeset.create!(:repository => self, | |
51 |
|
|
51 | :revision => revision.identifier, | |
52 |
|
|
52 | :scmid => revision.scmid, | |
53 |
:committe |
|
53 | :committer => revision.author, | |
54 |
:commen |
|
54 | :committed_on => revision.time, | |
55 |
|
55 | :comments => revision.message) | ||
56 | revision.paths.each do |change| |
|
56 | ||
57 | Change.create(:changeset => changeset, |
|
57 | revision.paths.each do |change| | |
58 | :action => change[:action], |
|
58 | Change.create!(:changeset => changeset, | |
59 |
|
|
59 | :action => change[:action], | |
60 |
: |
|
60 | :path => change[:path], | |
61 |
:from_ |
|
61 | :from_path => change[:from_path], | |
|
62 | :from_revision => change[:from_revision]) | |||
|
63 | end | |||
62 | end |
|
64 | end | |
63 | end |
|
65 | end | |
64 | end |
|
66 | end |
@@ -42,7 +42,7 class RepositoryGitTest < Test::Unit::TestCase | |||||
42 | def test_fetch_changesets_incremental |
|
42 | def test_fetch_changesets_incremental | |
43 | @repository.fetch_changesets |
|
43 | @repository.fetch_changesets | |
44 | # Remove the 3 latest changesets |
|
44 | # Remove the 3 latest changesets | |
45 | @repository.changesets.find(:all, :order => 'id DESC', :limit => 3).each(&:destroy) |
|
45 | @repository.changesets.find(:all, :order => 'committed_on DESC', :limit => 3).each(&:destroy) | |
46 | @repository.reload |
|
46 | @repository.reload | |
47 | assert_equal 3, @repository.changesets.count |
|
47 | assert_equal 3, @repository.changesets.count | |
48 |
|
48 |
General Comments 0
You need to be logged in to leave comments.
Login now