summaryrefslogtreecommitdiffstats
path: root/app/controllers/repositories_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-03-25 12:12:15 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-03-25 12:12:15 +0000
commit16f9f50f50dbac49b1f791c7c2892420a354bc43 (patch)
treeefaebfb9dd13bde6d45afa36b39063772d9116de /app/controllers/repositories_controller.rb
parent6f1dcdc08f401923ac77254ca22fd520582bcf6f (diff)
downloadredmine-16f9f50f50dbac49b1f791c7c2892420a354bc43.tar.gz
redmine-16f9f50f50dbac49b1f791c7c2892420a354bc43.zip
SVN commits are now stored in the database, and added to the activity view and the search engine.
New commits are automatically retrieved and stored when consulting the repository in the app. This behaviour can be disabled by unchecking 'Autofecth commits' in configuration settings. Commits can be fetched offline by running (recommanded at least for the initial import of past commits): ruby script/runner "Repository.fetch_changesets" It will load commits for all of the repositories. git-svn-id: http://redmine.rubyforge.org/svn/trunk@377 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/repositories_controller.rb')
-rw-r--r--app/controllers/repositories_controller.rb24
1 files changed, 16 insertions, 8 deletions
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index acf03eb7b..94b81080f 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -1,5 +1,5 @@
# redMine - project management software
-# Copyright (C) 2006 Jean-Philippe Lang
+# Copyright (C) 2006-2007 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -20,9 +20,16 @@ class RepositoriesController < ApplicationController
before_filter :find_project, :authorize
def show
+ # get entries for the browse frame
@entries = @repository.scm.entries('')
show_error and return unless @entries
- @latest_revision = @entries.revisions.latest
+ # check if new revisions have been committed in the repository
+ scm_latestrev = @entries.revisions.latest
+ if Setting.autofetch_changesets? && scm_latestrev && ((@repository.latest_changeset.nil?) || (@repository.latest_changeset.revision < scm_latestrev.identifier.to_i))
+ @repository.fetch_changesets
+ @repository.reload
+ end
+ @changesets = @repository.changesets.find(:all, :limit => 5, :order => "committed_on DESC")
end
def browse
@@ -31,9 +38,11 @@ class RepositoriesController < ApplicationController
end
def revisions
- @entry = @repository.scm.entry(@path, @rev)
- @revisions = @repository.scm.revisions(@path, @rev)
- show_error and return unless @entry && @revisions
+ unless @path == ''
+ @entry = @repository.scm.entry(@path, @rev)
+ show_error and return unless @entry
+ end
+ @changesets = @repository.changesets_for_path(@path)
end
def entry
@@ -45,9 +54,8 @@ class RepositoriesController < ApplicationController
end
def revision
- @revisions = @repository.scm.revisions '', @rev, @rev, :with_paths => true
- show_error and return unless @revisions
- @revision = @revisions.first
+ @changeset = @repository.changesets.find_by_revision(@rev)
+ show_error and return unless @changeset
end
def diff