Mercurial > hg > soundsoftware-site
diff app/models/repository/cvs.rb @ 1338:25603efa57b5
Merge from live branch
author | Chris Cannam |
---|---|
date | Thu, 20 Jun 2013 13:14:14 +0100 |
parents | 51d7f3e06556 |
children | 4f746d8966dd 51364c0cd58f |
line wrap: on
line diff
--- a/app/models/repository/cvs.rb Wed Jan 23 13:11:25 2013 +0000 +++ b/app/models/repository/cvs.rb Thu Jun 20 13:14:14 2013 +0100 @@ -1,5 +1,5 @@ # Redmine - project management software -# Copyright (C) 2006-2011 Jean-Philippe Lang +# Copyright (C) 2006-2012 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 @@ -15,20 +15,23 @@ # 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/cvs_adapter' +require_dependency 'redmine/scm/adapters/cvs_adapter' require 'digest/sha1' class Repository::Cvs < Repository validates_presence_of :url, :root_url, :log_encoding - def self.human_attribute_name(attribute_key_name) - attr_name = attribute_key_name + safe_attributes 'root_url', + :if => lambda {|repository, user| repository.new_record?} + + def self.human_attribute_name(attribute_key_name, *args) + attr_name = attribute_key_name.to_s if attr_name == "root_url" attr_name = "cvsroot" elsif attr_name == "url" attr_name = "cvs_module" end - super(attr_name) + super(attr_name, *args) end def self.scm_adapter_class @@ -54,7 +57,7 @@ if entries entries.each() do |entry| if ( ! entry.lastrev.nil? ) && ( ! entry.lastrev.revision.nil? ) - change=changes.find_by_revision_and_path( + change = filechanges.find_by_revision_and_path( entry.lastrev.revision, scm.with_leading_slash(entry.path) ) if change @@ -66,6 +69,7 @@ end end end + load_entries_changesets(entries) entries end @@ -94,7 +98,7 @@ if rev_to.to_i > 0 changeset_to = changesets.find_by_revision(rev_to) end - changeset_from.changes.each() do |change_from| + changeset_from.filechanges.each() do |change_from| revision_from = nil revision_to = nil if path.nil? || (change_from.path.starts_with? scm.with_leading_slash(path)) @@ -102,7 +106,7 @@ end if revision_from if changeset_to - changeset_to.changes.each() do |change_to| + changeset_to.filechanges.each() do |change_to| revision_to = change_to.revision if change_to.path == change_from.path end end @@ -133,7 +137,7 @@ # only add the change to the database, if it doen't exists. the cvs log # is not exclusive at all. tmp_time = revision.time.clone - unless changes.find_by_path_and_revision( + unless filechanges.find_by_path_and_revision( scm.with_leading_slash(revision.paths[0][:path]), revision.paths[0][:revision] ) @@ -181,10 +185,9 @@ end # Renumber new changesets in chronological order - changesets.find( - :all, + Changeset.all( :order => 'committed_on ASC, id ASC', - :conditions => "revision LIKE 'tmp%'" + :conditions => ["repository_id = ? AND revision LIKE 'tmp%'", id] ).each do |changeset| changeset.update_attribute :revision, next_revision_number end