##// END OF EJS Templates
Added request and controller objects to the hooks by default....
Added request and controller objects to the hooks by default. The request and controller objects are now added to all hook contexts by default. This will also make url_for work better in hooks by setting up the default_url_options :host, :port, and :protocol. Finally a new helper method @render_or@ has been added to ViewListener. This will let a hook easily render a partial without a full method definition. Thanks to Thomas Löber for the original patch. #2542 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2429 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r2348:ab5e07e83ef2
r2368:5b7a5c39a7da
Show More
git.rb
71 lines | 2.7 KiB | text/x-ruby | RubyLexer
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 # redMine - project management software
# Copyright (C) 2006-2007 Jean-Philippe Lang
# Copyright (C) 2007 Patrick Aljord patcito@ŋmail.com
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require 'redmine/scm/adapters/git_adapter'
class Repository::Git < Repository
attr_protected :root_url
validates_presence_of :url
def scm_adapter
Redmine::Scm::Adapters::GitAdapter
end
def self.scm_name
'Git'
end
Jean-Philippe Lang
Adds a setting to limit the number of revisions displayed on a repository file log (default=100)....
r2348 def changesets_for_path(path, options={})
Jean-Philippe Lang
Eager-load users....
r2007 Change.find(:all, :include => {:changeset => :user},
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 :conditions => ["repository_id = ? AND path = ?", id, path],
Jean-Philippe Lang
Adds a setting to limit the number of revisions displayed on a repository file log (default=100)....
r2348 :order => "committed_on DESC, #{Changeset.table_name}.revision DESC",
:limit => options[:limit]).collect(&:changeset)
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 end
def fetch_changesets
scm_info = scm.info
if scm_info
# latest revision found in database
db_revision = latest_changeset ? latest_changeset.revision : nil
# latest revision in the repository
scm_revision = scm_info.lastrev.scmid
unless changesets.find_by_scmid(scm_revision)
Jean-Philippe Lang
Reduces memory usage when importing large git repositories (#1482)....
r1585 scm.revisions('', db_revision, nil, :reverse => true) do |revision|
Jean-Philippe Lang
Check that git changeset is not in the database before creating it (#1419)....
r1951 if changesets.find_by_scmid(revision.scmid.to_s).nil?
transaction do
changeset = Changeset.create!(:repository => self,
:revision => revision.identifier,
:scmid => revision.scmid,
:committer => revision.author,
:committed_on => revision.time,
:comments => revision.message)
revision.paths.each do |change|
Change.create!(:changeset => changeset,
:action => change[:action],
:path => change[:path],
:from_path => change[:from_path],
:from_revision => change[:from_revision])
end
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 end
end
end
end
end
end
end