From d04d3f181a7d2c4daff2536bd80439b2e19b88e3 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 9 Feb 2010 18:42:42 +0000 Subject: [PATCH] Fixed: Repository.fetch_changesets tries to fetch changesets for archived projects (#4782). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3402 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/repository.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/models/repository.rb b/app/models/repository.rb index 9f0861b1a..da1168dfd 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -159,11 +159,15 @@ class Repository < ActiveRecord::Base end end - # fetch new changesets for all repositories - # can be called periodically by an external script + # Fetches new changesets for all repositories of active projects + # Can be called periodically by an external script # eg. ruby script/runner "Repository.fetch_changesets" def self.fetch_changesets - find(:all).each(&:fetch_changesets) + Project.active.has_module(:repository).find(:all, :include => :repository).each do |project| + if project.repository + project.repository.fetch_changesets + end + end end # scan changeset comments to find related and fixed issues for all repositories