##// END OF EJS Templates
Translations update (close #845, #822):...
Translations update (close #845, #822): * Finnish (Antti Perkiömäki) * Czech (Maxim Krušina) git-svn-id: http://redmine.rubyforge.org/svn/trunk@1253 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r1234:4957752d1223
r1238:185ecd585438
Show More
repository.rb
110 lines | 3.0 KiB | text/x-ruby | RubyLexer
Jean-Philippe Lang
svn browser merged in trunk...
r103 # redMine - project management software
Jean-Philippe Lang
SVN commits are now stored in the database, and added to the activity view and the search engine....
r374 # Copyright (C) 2006-2007 Jean-Philippe Lang
Jean-Philippe Lang
svn browser merged in trunk...
r103 #
# 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.
class Repository < ActiveRecord::Base
belongs_to :project
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 has_many :changesets, :dependent => :destroy, :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC"
Jean-Philippe Lang
added simple svn statistics graphs, rendered using SVG::Graph...
r377 has_many :changes, :through => :changesets
Jean-Philippe Lang
svn browser merged in trunk...
r103
Jean-Philippe Lang
Strip repository urls (closes #852)....
r1234 # Removes leading and trailing whitespace
def url=(arg)
write_attribute(:url, arg ? arg.to_s.strip : nil)
end
# Removes leading and trailing whitespace
def root_url=(arg)
write_attribute(:root_url, arg ? arg.to_s.strip : nil)
end
Jean-Philippe Lang
svn browser merged in trunk...
r103 def scm
Jean-Philippe Lang
Added basic support for CVS and Mercurial SCMs....
r556 @scm ||= self.scm_adapter.new url, root_url, login, password
Jean-Philippe Lang
fixed problems when svn path doesn't point to the root directory of the repository....
r341 update_attribute(:root_url, @scm.root_url) if root_url.blank?
@scm
end
Jean-Philippe Lang
Added basic support for CVS and Mercurial SCMs....
r556 def scm_name
self.class.scm_name
Jean-Philippe Lang
SVN commits are now stored in the database, and added to the activity view and the search engine....
r374 end
Jean-Philippe Lang
Added Darcs basic support....
r570 def supports_cat?
scm.supports_cat?
end
Jean-Philippe Lang
Added Annotate/Blame view for Subversion, CVS and Mercurial repositories....
r934
def supports_annotate?
scm.supports_annotate?
end
Jean-Philippe Lang
Added Darcs basic support....
r570
Jean-Philippe Lang
Added basic support for CVS and Mercurial SCMs....
r556 def entries(path=nil, identifier=nil)
scm.entries(path, identifier)
Jean-Philippe Lang
added pagination on revisions list...
r378 end
Jean-Philippe Lang
Added basic support for CVS and Mercurial SCMs....
r556 def diff(path, rev, rev_to, type)
scm.diff(path, rev, rev_to, type)
Jean-Philippe Lang
SVN commits are now stored in the database, and added to the activity view and the search engine....
r374 end
Jean-Philippe Lang
Fixed: log is not displayed when browsing a copy in a svn repository....
r830 # Default behaviour: we search in cached changesets
def changesets_for_path(path)
path = "/#{path}" unless path.starts_with?('/')
Change.find(:all, :include => :changeset,
:conditions => ["repository_id = ? AND path = ?", id, path],
Jean-Philippe Lang
Merged Git support branch (r1200 to r1226)....
r1222 :order => "committed_on DESC, #{Changeset.table_name}.id DESC").collect(&:changeset)
Jean-Philippe Lang
Fixed: log is not displayed when browsing a copy in a svn repository....
r830 end
Jean-Philippe Lang
Added basic support for CVS and Mercurial SCMs....
r556 def latest_changeset
@latest_changeset ||= changesets.find(:first)
end
Jean-Philippe Lang
Commit messages are now scanned for referenced or fixed issue IDs....
r470 def scan_changesets_for_issue_ids
self.changesets.each(&:scan_comment_for_issue_ids)
end
Jean-Philippe Lang
SVN commits are now stored in the database, and added to the activity view and the search engine....
r374 # fetch new changesets for all repositories
# can be called periodically by an external script
# eg. ruby script/runner "Repository.fetch_changesets"
def self.fetch_changesets
find(:all).each(&:fetch_changesets)
Jean-Philippe Lang
svn browser merged in trunk...
r103 end
Jean-Philippe Lang
Commit messages are now scanned for referenced or fixed issue IDs....
r470
# scan changeset comments to find related and fixed issues for all repositories
def self.scan_changesets_for_issue_ids
find(:all).each(&:scan_changesets_for_issue_ids)
end
Jean-Philippe Lang
Added basic support for CVS and Mercurial SCMs....
r556
def self.scm_name
'Abstract'
end
def self.available_scm
subclasses.collect {|klass| [klass.scm_name, klass.name]}
end
def self.factory(klass_name, *args)
klass = "Repository::#{klass_name}".constantize
klass.new(*args)
rescue
nil
end
Jean-Philippe Lang
Strip repository urls (closes #852)....
r1234
private
def before_save
# Strips url and root_url
url.strip!
root_url.strip!
true
end
Jean-Philippe Lang
svn browser merged in trunk...
r103 end