Mercurial > hg > soundsoftware-site
diff app/models/repository/cvs.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbce1fd3b1b7 |
children | 51d7f3e06556 622f24f53b42 261b3d9a4903 |
line wrap: on
line diff
--- a/app/models/repository/cvs.rb Wed Jun 27 14:54:18 2012 +0100 +++ b/app/models/repository/cvs.rb Mon Jan 07 12:01:42 2013 +0000 @@ -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 @@ -21,14 +21,17 @@ 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