Mercurial > hg > soundsoftware-site
diff app/models/repository.rb @ 1517:dffacf8a6908 redmine-2.5
Update to Redmine SVN revision 13367 on 2.5-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:29:00 +0100 |
parents | e248c7af89ec |
children | a1bdbf8a87d5 |
line wrap: on
line diff
--- a/app/models/repository.rb Tue Sep 09 09:28:31 2014 +0100 +++ b/app/models/repository.rb Tue Sep 09 09:29:00 2014 +0100 @@ -40,7 +40,7 @@ validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :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) + validates_exclusion_of :identifier, :in => %w(browse show entry raw changes annotate diff statistics graph revisions revision) # donwcase letters, digits, dashes, underscores but not digits only validates_format_of :identifier, :with => /\A(?!\d+$)[a-z0-9\-_]*\z/, :allow_blank => true # Checks if the SCM is enabled when creating a repository @@ -194,8 +194,13 @@ scm.entry(path, identifier) end + def scm_entries(path=nil, identifier=nil) + scm.entries(path, identifier) + end + protected :scm_entries + def entries(path=nil, identifier=nil) - entries = scm.entries(path, identifier) + entries = scm_entries(path, identifier) load_entries_changesets(entries) entries end @@ -287,9 +292,8 @@ 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) - Changeset.update_all( - "user_id = #{ new_user_id.nil? ? 'NULL' : new_user_id }", - ["repository_id = ? AND committer = ?", id, committer]) + Changeset.where(["repository_id = ? AND committer = ?", id, committer]). + update_all("user_id = #{new_user_id.nil? ? 'NULL' : new_user_id}") end end @committers = nil @@ -408,7 +412,7 @@ self.is_default = true end if is_default? && is_default_changed? - Repository.update_all(["is_default = ?", false], ["project_id = ?", project_id]) + Repository.where(["project_id = ?", project_id]).update_all(["is_default = ?", false]) end end