scm: git: use Changeset#create and Changeset#create_change as same with Subversion and Mercurial
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9290 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
cdb7ea8b91
commit
f36eb54141
|
@ -208,12 +208,7 @@ class Repository::Git < Repository
|
||||||
transaction do
|
transaction do
|
||||||
# There is no search in the db for this revision, because above we ensured,
|
# There is no search in the db for this revision, because above we ensured,
|
||||||
# that it's not in the db.
|
# that it's not in the db.
|
||||||
db_saved_rev = save_revision(rev)
|
save_revision(rev)
|
||||||
parents = {}
|
|
||||||
parents[db_saved_rev] = rev.parents unless rev.parents.nil?
|
|
||||||
parents.each do |ch, chparents|
|
|
||||||
ch.parents = chparents.collect{|rp| find_changeset_by_name(rp)}.compact
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
h["heads"] = repo_heads.dup
|
h["heads"] = repo_heads.dup
|
||||||
|
@ -223,7 +218,7 @@ class Repository::Git < Repository
|
||||||
private :save_revisions
|
private :save_revisions
|
||||||
|
|
||||||
def save_revision(rev)
|
def save_revision(rev)
|
||||||
changeset = Changeset.new(
|
changeset = Changeset.create(
|
||||||
:repository => self,
|
:repository => self,
|
||||||
:revision => rev.identifier,
|
:revision => rev.identifier,
|
||||||
:scmid => rev.scmid,
|
:scmid => rev.scmid,
|
||||||
|
@ -231,12 +226,12 @@ class Repository::Git < Repository
|
||||||
:committed_on => rev.time,
|
:committed_on => rev.time,
|
||||||
:comments => rev.message
|
:comments => rev.message
|
||||||
)
|
)
|
||||||
if changeset.save
|
unless changeset.new_record?
|
||||||
rev.paths.each do |file|
|
rev.paths.each { |change| changeset.create_change(change) }
|
||||||
Change.create(
|
parents = {}
|
||||||
:changeset => changeset,
|
parents[changeset] = rev.parents unless rev.parents.nil?
|
||||||
:action => file[:action],
|
parents.each do |ch, chparents|
|
||||||
:path => file[:path])
|
ch.parents = chparents.collect{|rp| find_changeset_by_name(rp)}.compact
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
changeset
|
changeset
|
||||||
|
|
Loading…
Reference in New Issue