##// END OF EJS Templates
scm: git: performance improvements in fetching revisions (#8857, #9472)...
scm: git: performance improvements in fetching revisions (#8857, #9472) Parse a revision for a given branch, just if we haven't parsed it for any branches before. Moved the db check to for existing revisions into a grouped search. Search for many revisions at once: this reduces db load. Revisions are grouped into sets of 100. This is to improve memory consumption. There will be just one query instead of each 100. The above two methods significantly increase parsing speed. Test case was a git repo with 6000+ commits on a master branch, and several other branches originating for master. Speed improved from 1.4h to 18min. Contributed by Gergely Fábián. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9144 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r8850:cd9b62d7344d
r9024:999a4ba30d7b
Show More
repository.rb
419 lines | 11.0 KiB | text/x-ruby | RubyLexer
Toshi MARUYAMA
scm: code clean up repository model....
r5533 # Redmine - project management software
# Copyright (C) 2006-2011 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.
Toshi MARUYAMA
scm: code clean up repository model....
r5533 #
Jean-Philippe Lang
svn browser merged in trunk...
r103 # 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.
Toshi MARUYAMA
scm: code clean up repository model....
r5533 #
Jean-Philippe Lang
svn browser merged in trunk...
r103 # 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.
Toshi MARUYAMA
scm: add exception of fetching revisions error in repository model (#5357, #2799, #4741, #8030)....
r5779 class ScmFetchError < Exception; end
Jean-Philippe Lang
svn browser merged in trunk...
r103 class Repository < ActiveRecord::Base
Jean-Philippe Lang
Adds support for SCM/LDAP passwords encryption in the database (#7411)....
r4830 include Redmine::Ciphering
Toshi MARUYAMA
scm: code clean up repository model....
r5533
Jean-Philippe Lang
svn browser merged in trunk...
r103 belongs_to :project
Jean-Philippe Lang
Clear changesets and changes with raw sql when deleting a repository (#1627)....
r1651 has_many :changesets, :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
Toshi MARUYAMA
scm: code clean up repository model....
r5533
Toshi MARUYAMA
scm: add "extra_info" column to repositories table and set serialize (#7146, #7047)....
r5642 serialize :extra_info
Jean-Philippe Lang
Adds support for multiple repositories per project (#779)....
r8530 before_save :check_default
Jean-Philippe Lang
Clear changesets and changes with raw sql when deleting a repository (#1627)....
r1651 # Raw SQL to delete changesets and changes in the database
# has_many :changesets, :dependent => :destroy is too slow for big repositories
before_destroy :clear_changesets
Toshi MARUYAMA
scm: code clean up repository model....
r5533
Jean-Philippe Lang
Adds support for SCM/LDAP passwords encryption in the database (#7411)....
r4830 validates_length_of :password, :maximum => 255, :allow_nil => true
Jean-Philippe Lang
Adds support for multiple repositories per project (#779)....
r8530 validates_length_of :identifier, :maximum => 255, :allow_blank => true
validates_presence_of :identifier, :unless => Proc.new { |r| r.is_default? || r.set_as_default? }
validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true
validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph)
# donwcase letters, digits, dashes but not digits only
validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-]*$/, :allow_blank => true
Jean-Philippe Lang
Ability to disable unused SCM adapters in application settings....
r1493 # Checks if the SCM is enabled when creating a repository
Toshi MARUYAMA
Rails3: replace deprecated 'validate_on_create' to declared validation method at Repository model....
r6597 validate :repo_create_validation, :on => :create
def repo_create_validation
unless Setting.enabled_scm.include?(self.class.name.demodulize)
errors.add(:type, :invalid)
end
end
Toshi MARUYAMA
scm: update adapter initialize() to use path encoding (#2664, #2274)....
r4821
Jean-Philippe Lang
human_attribute_name accepts optional argument....
r8166 def self.human_attribute_name(attribute_key_name, *args)
Toshi MARUYAMA
Rails3: scm: use .to_s for overriding human_attribute_name parameter at repository model...
r8850 attr_name = attribute_key_name.to_s
Toshi MARUYAMA
scm: use i18n string at commit log encoding setting (#1735)....
r5399 if attr_name == "log_encoding"
attr_name = "commit_logs_encoding"
end
Jean-Philippe Lang
human_attribute_name accepts optional argument....
r8166 super(attr_name, *args)
Toshi MARUYAMA
scm: use i18n string at commit log encoding setting (#1735)....
r5399 end
Jean-Philippe Lang
Resourcified repositories for CRUD operations to prepare for multiple SCM per project (#779)....
r8528 alias :attributes_without_extra_info= :attributes=
def attributes=(new_attributes, guard_protected_attributes = true)
return if new_attributes.nil?
attributes = new_attributes.dup
attributes.stringify_keys!
p = {}
p_extra = {}
attributes.each do |k, v|
if k =~ /^extra_/
p_extra[k] = v
else
p[k] = v
end
end
send :attributes_without_extra_info=, p, guard_protected_attributes
Jean-Philippe Lang
Adds support for multiple repositories per project (#779)....
r8530 if p_extra.keys.any?
merge_extra_info(p_extra)
end
Jean-Philippe Lang
Resourcified repositories for CRUD operations to prepare for multiple SCM per project (#779)....
r8528 end
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
Toshi MARUYAMA
scm: update adapter initialize() to use path encoding (#2664, #2274)....
r4821
Jean-Philippe Lang
Strip repository urls (closes #852)....
r1234 # Removes leading and trailing whitespace
def root_url=(arg)
write_attribute(:root_url, arg ? arg.to_s.strip : nil)
end
Toshi MARUYAMA
scm: code clean up repository model....
r5533
Jean-Philippe Lang
Adds support for SCM/LDAP passwords encryption in the database (#7411)....
r4830 def password
read_ciphered_attribute(:password)
end
Toshi MARUYAMA
scm: code clean up repository model....
r5533
Jean-Philippe Lang
Adds support for SCM/LDAP passwords encryption in the database (#7411)....
r4830 def password=(arg)
write_ciphered_attribute(:password, arg)
end
Jean-Philippe Lang
Strip repository urls (closes #852)....
r1234
Toshi MARUYAMA
scm: add scm command and version methods at repository models (#4273)....
r4702 def scm_adapter
self.class.scm_adapter_class
end
Jean-Philippe Lang
svn browser merged in trunk...
r103 def scm
Jean-Philippe Lang
Skip a bunch of useless "UPDATE repositories SET extra_info = ..." queries when navigating in repositories....
r8538 unless @scm
@scm = self.scm_adapter.new(url, root_url,
Toshi MARUYAMA
scm: update adapter initialize() to use path encoding (#2664, #2274)....
r4821 login, password, path_encoding)
Jean-Philippe Lang
Skip a bunch of useless "UPDATE repositories SET extra_info = ..." queries when navigating in repositories....
r8538 if root_url.blank? && @scm.root_url.present?
update_attribute(:root_url, @scm.root_url)
end
end
Jean-Philippe Lang
fixed problems when svn path doesn't point to the root directory of the repository....
r341 @scm
end
Toshi MARUYAMA
scm: update adapter initialize() to use path encoding (#2664, #2274)....
r4821
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
Toshi MARUYAMA
scm: add scm command and version methods at repository models (#4273)....
r4702
Jean-Philippe Lang
Adds support for multiple repositories per project (#779)....
r8530 def name
Jean-Philippe Lang
Display identifier for the default repository too (#779)....
r8534 if identifier.present?
Jean-Philippe Lang
Adds support for multiple repositories per project (#779)....
r8530 identifier
Jean-Philippe Lang
Display identifier for the default repository too (#779)....
r8534 elsif is_default?
l(:field_repository_is_default)
Jean-Philippe Lang
Adds support for multiple repositories per project (#779)....
r8530 else
scm_name
end
end
def identifier_param
if is_default?
nil
elsif identifier.present?
identifier
else
id.to_s
end
end
def <=>(repository)
if is_default?
-1
elsif repository.is_default?
1
else
identifier <=> repository.identifier
end
end
def self.find_by_identifier_param(param)
if param.to_s =~ /^\d+$/
find_by_id(param)
else
find_by_identifier(param)
end
end
Toshi MARUYAMA
scm: add a repository model method "merge_extra_info()" to merge "extra_info" serializing hash yaml (#7146, #7047)....
r5646 def merge_extra_info(arg)
h = extra_info || {}
return h if arg.nil?
h.merge!(arg)
write_attribute(:extra_info, h)
end
Toshi MARUYAMA
scm: git: show only filename and filesize if setting of reporting last commit is disable (#8365, #7047)....
r5655 def report_last_commit
true
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
Toshi MARUYAMA
scm: set supporting all revisions or not at scm level....
r5023
def supports_all_revisions?
true
end
Toshi MARUYAMA
scm: code clean up repository model....
r5533
Toshi MARUYAMA
scm: set supporting directory revisions or not at scm level....
r5024 def supports_directory_revisions?
false
end
Toshi MARUYAMA
scm: code clean up repository model....
r5533
Toshi MARUYAMA
scm: model: add method to switch revision graph support or not and set default false (#5501)...
r7596 def supports_revision_graph?
false
end
Jean-Philippe Lang
Fixed: view file at given revision with CVS....
r1539 def entry(path=nil, identifier=nil)
scm.entry(path, identifier)
end
Toshi MARUYAMA
scm: code clean up repository model....
r5533
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
Eric Davis
Added branch and tag support to the git repository viewer. (#1406)...
r2735
def branches
scm.branches
end
def tags
scm.tags
end
def default_branch
Toshi MARUYAMA
scm: return nil at model default_branch and override at git model (#8458, #6713)....
r6010 nil
Eric Davis
Added branch and tag support to the git repository viewer. (#1406)...
r2735 end
Toshi MARUYAMA
scm: set supporting all revisions or not at scm level....
r5023
Jean-Philippe Lang
Display svn properties in the browser, svn >= 1.5.0 only (#1581)....
r1613 def properties(path, identifier=nil)
scm.properties(path, identifier)
end
Toshi MARUYAMA
scm: set supporting all revisions or not at scm level....
r5023
Jean-Philippe Lang
Fixed: view file at given revision with CVS....
r1539 def cat(path, identifier=nil)
scm.cat(path, identifier)
end
Toshi MARUYAMA
scm: set supporting all revisions or not at scm level....
r5023
Jean-Philippe Lang
Move unified diff parser out of the scm abstract adapter so it can be reused for viewing attached diffs (#1403)....
r1499 def diff(path, rev, rev_to)
scm.diff(path, rev, rev_to)
Jean-Philippe Lang
SVN commits are now stored in the database, and added to the activity view and the search engine....
r374 end
Toshi MARUYAMA
scm: changing two revision diff text at SCM adapter level (#3724)....
r4578
def diff_format_revisions(cs, cs_to, sep=':')
text = ""
text << cs_to.format_identifier + sep if cs_to
text << cs.format_identifier if cs
text
end
Jean-Philippe Lang
Fixed: View differences for individual file of a changeset fails if the subversion repository URL doesn't point to the repository root (#1209, #1262, #1275)....
r1432 # Returns a path relative to the url of the repository
def relative_path(path)
path
end
Toshi MARUYAMA
scm: use #blank? instead of #nil? || #empty? at Repository#find_changeset_by_name(name) (#7307)....
r4592
Jean-Philippe Lang
Fixed: RepositoriesController#revision may show wrong revision (#3779)....
r2784 # Finds and returns a revision with a number or the beginning of a hash
def find_changeset_by_name(name)
Toshi MARUYAMA
scm: use #blank? instead of #nil? || #empty? at Repository#find_changeset_by_name(name) (#7307)....
r4592 return nil if name.blank?
Toshi MARUYAMA
scm: use to_s for revision in find_changeset_by_name method...
r8811 s = name.to_s
changesets.find(:first, :conditions => (s.match(/^\d*$/) ?
["revision = ?", s] : ["revision LIKE ?", s + '%']))
Jean-Philippe Lang
Fixed: RepositoriesController#revision may show wrong revision (#3779)....
r2784 end
Toshi MARUYAMA
scm: use #blank? instead of #nil? || #empty? at Repository#find_changeset_by_name(name) (#7307)....
r4592
Jean-Philippe Lang
Added basic support for CVS and Mercurial SCMs....
r556 def latest_changeset
@latest_changeset ||= changesets.find(:first)
end
Eric Davis
Added branch and tag support to the git repository viewer. (#1406)...
r2735
Jean-Philippe Lang
SCM:...
r2739 # Returns the latest changesets for +path+
# Default behaviour is to search in cached changesets
def latest_changesets(path, rev, limit=10)
if path.blank?
Toshi MARUYAMA
scm: code clean up repository model....
r5533 changesets.find(
:all,
:include => :user,
:order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC",
:limit => limit)
Jean-Philippe Lang
SCM:...
r2739 else
Toshi MARUYAMA
scm: code clean up repository model....
r5533 changes.find(
:all,
:include => {:changeset => :user},
:conditions => ["path = ?", path.with_leading_slash],
:order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC",
:limit => limit
).collect(&:changeset)
Jean-Philippe Lang
SCM:...
r2739 end
Eric Davis
Added branch and tag support to the git repository viewer. (#1406)...
r2735 end
Toshi MARUYAMA
scm: code clean up repository model....
r5527
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
Eric Davis
Added branch and tag support to the git repository viewer. (#1406)...
r2735
Jean-Philippe Lang
Maps repository users to Redmine users (#1383)....
r2004 # Returns an array of committers usernames and associated user_id
def committers
Toshi MARUYAMA
scm: code clean up repository model....
r5527 @committers ||= Changeset.connection.select_rows(
"SELECT DISTINCT committer, user_id FROM #{Changeset.table_name} WHERE repository_id = #{id}")
Jean-Philippe Lang
Maps repository users to Redmine users (#1383)....
r2004 end
Toshi MARUYAMA
scm: code clean up repository model....
r5527
Jean-Philippe Lang
Maps repository users to Redmine users (#1383)....
r2004 # Maps committers username to a user ids
def committer_ids=(h)
if h.is_a?(Hash)
committers.each do |committer, user_id|
new_user_id = h[committer]
if new_user_id && (new_user_id.to_i != user_id.to_i)
new_user_id = (new_user_id.to_i > 0 ? new_user_id.to_i : nil)
Toshi MARUYAMA
scm: code clean up repository model....
r5527 Changeset.update_all(
"user_id = #{ new_user_id.nil? ? 'NULL' : new_user_id }",
["repository_id = ? AND committer = ?", id, committer])
Jean-Philippe Lang
Maps repository users to Redmine users (#1383)....
r2004 end
end
Toshi MARUYAMA
scm: code clean up repository model....
r5527 @committers = nil
Jean-Philippe Lang
Memorize commit authors to speed up changesets loading....
r3358 @found_committer_users = nil
Jean-Philippe Lang
Maps repository users to Redmine users (#1383)....
r2004 true
else
false
end
end
Toshi MARUYAMA
scm: code clean up repository model....
r5527
Jean-Philippe Lang
Maps repository users to Redmine users (#1383)....
r2004 # Returns the Redmine User corresponding to the given +committer+
# It will return nil if the committer is not yet mapped and if no User
# with the same username or email was found
def find_committer_user(committer)
Jean-Philippe Lang
Memorize commit authors to speed up changesets loading....
r3358 unless committer.blank?
@found_committer_users ||= {}
return @found_committer_users[committer] if @found_committer_users.has_key?(committer)
Toshi MARUYAMA
scm: code clean up repository model....
r5527
Jean-Philippe Lang
Memorize commit authors to speed up changesets loading....
r3358 user = nil
Jean-Philippe Lang
Maps repository users to Redmine users (#1383)....
r2004 c = changesets.find(:first, :conditions => {:committer => committer}, :include => :user)
if c && c.user
Jean-Philippe Lang
Memorize commit authors to speed up changesets loading....
r3358 user = c.user
Jean-Philippe Lang
Maps repository users to Redmine users (#1383)....
r2004 elsif committer.strip =~ /^([^<]+)(<(.*)>)?$/
username, email = $1.strip, $3
u = User.find_by_login(username)
u ||= User.find_by_mail(email) unless email.blank?
Jean-Philippe Lang
Memorize commit authors to speed up changesets loading....
r3358 user = u
Jean-Philippe Lang
Maps repository users to Redmine users (#1383)....
r2004 end
Jean-Philippe Lang
Memorize commit authors to speed up changesets loading....
r3358 @found_committer_users[committer] = user
user
Jean-Philippe Lang
Maps repository users to Redmine users (#1383)....
r2004 end
end
Toshi MARUYAMA
scm: catch exception of getting command and version in model (#4273)....
r4762
Toshi MARUYAMA
scm: ignore log encoding setting in Subversion and Mercurial (#7597)....
r4842 def repo_log_encoding
Toshi MARUYAMA
scm: add feature of per project repository log encoding setting (#1735)....
r4862 encoding = log_encoding.to_s.strip
Toshi MARUYAMA
scm: ignore log encoding setting in Subversion and Mercurial (#7597)....
r4842 encoding.blank? ? 'UTF-8' : encoding
end
Jean-Philippe Lang
Fixed: Repository.fetch_changesets tries to fetch changesets for archived projects (#4782)....
r3288 # Fetches new changesets for all repositories of active projects
# Can be called periodically by an external script
Jean-Philippe Lang
SVN commits are now stored in the database, and added to the activity view and the search engine....
r374 # eg. ruby script/runner "Repository.fetch_changesets"
def self.fetch_changesets
Jean-Philippe Lang
Adds support for multiple repositories per project (#779)....
r8530 Project.active.has_module(:repository).all.each do |project|
project.repositories.each do |repository|
Toshi MARUYAMA
scm: catch CommandFailed during bulk Repository.fetch_changesets (#4455)....
r4704 begin
Jean-Philippe Lang
Adds support for multiple repositories per project (#779)....
r8530 repository.fetch_changesets
Toshi MARUYAMA
scm: catch CommandFailed during bulk Repository.fetch_changesets (#4455)....
r4704 rescue Redmine::Scm::Adapters::CommandFailed => e
Toshi MARUYAMA
scm: catch exception of getting command and version in model (#4273)....
r4762 logger.error "scm: error during fetching changesets: #{e.message}"
Toshi MARUYAMA
scm: catch CommandFailed during bulk Repository.fetch_changesets (#4455)....
r4704 end
Jean-Philippe Lang
Fixed: Repository.fetch_changesets tries to fetch changesets for archived projects (#4782)....
r3288 end
end
Jean-Philippe Lang
svn browser merged in trunk...
r103 end
Toshi MARUYAMA
scm: catch exception of getting command and version in model (#4273)....
r4762
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
Toshi MARUYAMA
scm: code clean up repository model....
r5533
Jean-Philippe Lang
Added basic support for CVS and Mercurial SCMs....
r556 def self.available_scm
subclasses.collect {|klass| [klass.scm_name, klass.name]}
end
Toshi MARUYAMA
scm: ignore log encoding setting in Subversion and Mercurial (#7597)....
r4842
Jean-Philippe Lang
Added basic support for CVS and Mercurial SCMs....
r556 def self.factory(klass_name, *args)
klass = "Repository::#{klass_name}".constantize
klass.new(*args)
rescue
nil
end
Toshi MARUYAMA
scm: add scm command and version methods at repository models (#4273)....
r4702
def self.scm_adapter_class
nil
end
def self.scm_command
Toshi MARUYAMA
scm: catch exception of getting command and version in model (#4273)....
r4762 ret = ""
begin
ret = self.scm_adapter_class.client_command if self.scm_adapter_class
Toshi MARUYAMA
scm: catch all exceptions to get scm command version in repository model (#8510)....
r5879 rescue Exception => e
Toshi MARUYAMA
scm: catch exception of getting command and version in model (#4273)....
r4762 logger.error "scm: error during get command: #{e.message}"
end
ret
Toshi MARUYAMA
scm: add scm command and version methods at repository models (#4273)....
r4702 end
def self.scm_version_string
Toshi MARUYAMA
scm: catch exception of getting command and version in model (#4273)....
r4762 ret = ""
begin
ret = self.scm_adapter_class.client_version_string if self.scm_adapter_class
Toshi MARUYAMA
scm: catch all exceptions to get scm command version in repository model (#8510)....
r5879 rescue Exception => e
Toshi MARUYAMA
scm: catch exception of getting command and version in model (#4273)....
r4762 logger.error "scm: error during get version string: #{e.message}"
end
ret
Toshi MARUYAMA
scm: add scm command and version methods at repository models (#4273)....
r4702 end
def self.scm_available
Toshi MARUYAMA
scm: catch exception of getting command and version in model (#4273)....
r4762 ret = false
begin
Toshi MARUYAMA
scm: code clean up repository model....
r5533 ret = self.scm_adapter_class.client_available if self.scm_adapter_class
Toshi MARUYAMA
scm: catch all exceptions to get scm command version in repository model (#8510)....
r5879 rescue Exception => e
Toshi MARUYAMA
scm: catch exception of getting command and version in model (#4273)....
r4762 logger.error "scm: error during get scm available: #{e.message}"
end
ret
Toshi MARUYAMA
scm: add scm command and version methods at repository models (#4273)....
r4702 end
Jean-Philippe Lang
Adds support for multiple repositories per project (#779)....
r8530 def set_as_default?
new_record? && project && !Repository.first(:conditions => {:project_id => project.id})
end
protected
def check_default
if !is_default? && set_as_default?
self.is_default = true
end
if is_default? && is_default_changed?
Repository.update_all(["is_default = ?", false], ["project_id = ?", project_id])
end
end
Jean-Philippe Lang
Strip repository urls (closes #852)....
r1234 private
Toshi MARUYAMA
scm: update adapter initialize() to use path encoding (#2664, #2274)....
r4821
Jean-Philippe Lang
Fixed that changesets parents associations are not deleted when deleting a repository....
r8727 # Deletes repository data
Jean-Philippe Lang
Clear changesets and changes with raw sql when deleting a repository (#1627)....
r1651 def clear_changesets
Jean-Philippe Lang
Fixed that changesets parents associations are not deleted when deleting a repository....
r8727 cs = Changeset.table_name
ch = Change.table_name
ci = "#{table_name_prefix}changesets_issues#{table_name_suffix}"
cp = "#{table_name_prefix}changeset_parents#{table_name_suffix}"
Jean-Philippe Lang
Removes hardcoded table names in Repository#clear_changesets....
r2619 connection.delete("DELETE FROM #{ch} WHERE #{ch}.changeset_id IN (SELECT #{cs}.id FROM #{cs} WHERE #{cs}.repository_id = #{id})")
connection.delete("DELETE FROM #{ci} WHERE #{ci}.changeset_id IN (SELECT #{cs}.id FROM #{cs} WHERE #{cs}.repository_id = #{id})")
Jean-Philippe Lang
Fixed that changesets parents associations are not deleted when deleting a repository....
r8727 connection.delete("DELETE FROM #{cp} WHERE #{cp}.changeset_id IN (SELECT #{cs}.id FROM #{cs} WHERE #{cs}.repository_id = #{id})")
Jean-Philippe Lang
Removes hardcoded table names in Repository#clear_changesets....
r2619 connection.delete("DELETE FROM #{cs} WHERE #{cs}.repository_id = #{id}")
Jean-Philippe Lang
Clear changesets and changes with raw sql when deleting a repository (#1627)....
r1651 end
Jean-Philippe Lang
svn browser merged in trunk...
r103 end