summaryrefslogtreecommitdiffstats
path: root/app/models/repository
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-05-04 03:44:10 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-05-04 03:44:10 +0000
commit19c6266a7d0f743fd217e9c339f261689fd8ecd8 (patch)
tree81b876bc1d2d8a9c2f076c27a34bf694ee2fd140 /app/models/repository
parentcd34602b4ff8653ad01b3cf9cb39aa91ad056c28 (diff)
downloadredmine-19c6266a7d0f743fd217e9c339f261689fd8ecd8.tar.gz
redmine-19c6266a7d0f743fd217e9c339f261689fd8ecd8.zip
scm: git: refactor saving a revision in model.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5624 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/repository')
-rw-r--r--app/models/repository/git.rb31
1 files changed, 18 insertions, 13 deletions
diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb
index 43ee72bee..473c3535d 100644
--- a/app/models/repository/git.rb
+++ b/app/models/repository/git.rb
@@ -98,26 +98,31 @@ class Repository::Git < Repository
unless revisions.nil?
revisions.each do |rev|
transaction do
- changeset = Changeset.new(
- :repository => self,
- :revision => rev.identifier,
- :scmid => rev.scmid,
- :committer => rev.author,
+ save_revision(rev)
+ end
+ end
+ end
+ end
+
+ def save_revision(rev)
+ changeset = Changeset.new(
+ :repository => self,
+ :revision => rev.identifier,
+ :scmid => rev.scmid,
+ :committer => rev.author,
:committed_on => rev.time,
- :comments => rev.message)
-
- if changeset.save
- rev.paths.each do |file|
- Change.create(
+ :comments => rev.message
+ )
+ if changeset.save
+ rev.paths.each do |file|
+ Change.create(
:changeset => changeset,
:action => file[:action],
:path => file[:path])
- end
- end
- end
end
end
end
+ private :save_revision
def latest_changesets(path,rev,limit=10)
revisions = scm.revisions(path, nil, rev, :limit => limit, :all => false)