Compare commits

..

1 Commits
2.0.2 ... 2.0.1

Author SHA1 Message Date
Jean-Philippe Lang
924cf77a61 tagged version 2.0.1
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/tags/2.0.1@9733 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-05-28 07:25:08 +00:00
29 changed files with 51 additions and 115 deletions

View File

@@ -1,6 +1,6 @@
source 'http://rubygems.org'
gem 'rails', '3.2.5'
gem 'rails', '3.2.3'
gem 'prototype-rails', '3.2.1'
gem "i18n", "~> 0.6.0"
gem "coderay", "~> 1.0.6"

View File

@@ -18,13 +18,12 @@
class TimelogController < ApplicationController
menu_item :issues
before_filter :find_project_for_new_time_entry, :only => [:create]
before_filter :find_project, :only => [:create]
before_filter :find_time_entry, :only => [:show, :edit, :update]
before_filter :find_time_entries, :only => [:bulk_edit, :bulk_update, :destroy]
before_filter :authorize, :except => [:new, :index, :report]
before_filter :find_optional_project, :only => [:index, :report]
before_filter :find_optional_project_for_new_time_entry, :only => [:new]
before_filter :find_optional_project, :only => [:new, :index, :report]
before_filter :authorize_global, :only => [:new, :index, :report]
accept_rss_auth :index
@@ -134,13 +133,9 @@ class TimelogController < ApplicationController
flash[:notice] = l(:notice_successful_create)
if params[:continue]
if params[:project_id]
redirect_to :action => 'new', :project_id => @time_entry.project, :issue_id => @time_entry.issue,
:time_entry => {:issue_id => @time_entry.issue_id, :activity_id => @time_entry.activity_id},
:back_url => params[:back_url]
redirect_to :action => 'new', :project_id => @time_entry.project, :issue_id => @time_entry.issue, :back_url => params[:back_url]
else
redirect_to :action => 'new',
:time_entry => {:project_id => @time_entry.project_id, :issue_id => @time_entry.issue_id, :activity_id => @time_entry.activity_id},
:back_url => params[:back_url]
redirect_to :action => 'new', :back_url => params[:back_url]
end
else
redirect_back_or_default :action => 'index', :project_id => @time_entry.project
@@ -263,7 +258,7 @@ private
end
end
def find_optional_project_for_new_time_entry
def find_project
if (project_id = (params[:project_id] || params[:time_entry] && params[:time_entry][:project_id])).present?
@project = Project.find(project_id)
end
@@ -271,15 +266,12 @@ private
@issue = Issue.find(issue_id)
@project ||= @issue.project
end
rescue ActiveRecord::RecordNotFound
render_404
end
def find_project_for_new_time_entry
find_optional_project_for_new_time_entry
if @project.nil?
render_404
return false
end
rescue ActiveRecord::RecordNotFound
render_404
end
def find_optional_project

View File

@@ -46,17 +46,17 @@ module RepositoriesHelper
end
def render_changeset_changes
changes = @changeset.filechanges.find(:all, :limit => 1000, :order => 'path').collect do |change|
changes = @changeset.changes.find(:all, :limit => 1000, :order => 'path').collect do |change|
case change.action
when 'A'
# Detects moved/copied files
if !change.from_path.blank?
change.action =
@changeset.filechanges.detect {|c| c.action == 'D' && c.path == change.from_path} ? 'R' : 'C'
@changeset.changes.detect {|c| c.action == 'D' && c.path == change.from_path} ? 'R' : 'C'
end
change
when 'D'
@changeset.filechanges.detect {|c| c.from_path == change.path} ? nil : change
@changeset.changes.detect {|c| c.from_path == change.path} ? nil : change
else
change
end

View File

@@ -20,7 +20,7 @@ require 'iconv'
class Changeset < ActiveRecord::Base
belongs_to :repository
belongs_to :user
has_many :filechanges, :class_name => 'Change', :dependent => :delete_all
has_many :changes, :dependent => :delete_all
has_and_belongs_to_many :issues
has_and_belongs_to_many :parents,
:class_name => "Changeset",

View File

@@ -22,7 +22,7 @@ class Repository < ActiveRecord::Base
belongs_to :project
has_many :changesets, :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC"
has_many :filechanges, :class_name => 'Change', :through => :changesets
has_many :changes, :through => :changesets
serialize :extra_info
@@ -228,7 +228,7 @@ class Repository < ActiveRecord::Base
:order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC",
:limit => limit)
else
filechanges.find(
changes.find(
:all,
:include => {:changeset => :user},
:conditions => ["path = ?", path.with_leading_slash],

View File

@@ -54,7 +54,7 @@ class Repository::Cvs < Repository
if entries
entries.each() do |entry|
if ( ! entry.lastrev.nil? ) && ( ! entry.lastrev.revision.nil? )
change = filechanges.find_by_revision_and_path(
change=changes.find_by_revision_and_path(
entry.lastrev.revision,
scm.with_leading_slash(entry.path) )
if change
@@ -94,7 +94,7 @@ class Repository::Cvs < Repository
if rev_to.to_i > 0
changeset_to = changesets.find_by_revision(rev_to)
end
changeset_from.filechanges.each() do |change_from|
changeset_from.changes.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 +102,7 @@ class Repository::Cvs < Repository
end
if revision_from
if changeset_to
changeset_to.filechanges.each() do |change_to|
changeset_to.changes.each() do |change_to|
revision_to = change_to.revision if change_to.path == change_from.path
end
end
@@ -133,7 +133,7 @@ class Repository::Cvs < Repository
# 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 filechanges.find_by_path_and_revision(
unless changes.find_by_path_and_revision(
scm.with_leading_slash(revision.paths[0][:path]),
revision.paths[0][:revision]
)

View File

@@ -79,7 +79,7 @@ class Repository::Darcs < Repository
return nil if patch_from.nil?
patch_to = changesets.find_by_revision(rev_to) if rev_to
if path.blank?
path = patch_from.filechanges.collect{|change| change.path}.join(' ')
path = patch_from.changes.collect{|change| change.path}.join(' ')
end
patch_from ? scm.diff(path, patch_from.scmid, patch_to ? patch_to.scmid : nil) : nil
end

View File

@@ -7,14 +7,14 @@
<div class="next-prev-links contextual">
<%= link_to_if @prev_issue_id,
"\xc2\xab #{l(:label_previous)}",
(@prev_issue_id ? issue_path(@prev_issue_id) : nil),
issue_path(@prev_issue_id),
:title => "##{@prev_issue_id}" %> |
<% if @issue_position && @issue_count %>
<span class="position"><%= l(:label_item_position, :position => @issue_position, :count => @issue_count) %></span> |
<% end %>
<%= link_to_if @next_issue_id,
"#{l(:label_next)} \xc2\xbb",
(@next_issue_id ? issue_path(@next_issue_id) : nil),
issue_path(@next_issue_id),
:title => "##{@next_issue_id}" %>
</div>
<% end %>

View File

@@ -1,6 +1,6 @@
<%= labelled_remote_form_for @wiki,
:as => :wiki,
:url => { :controller => 'wikis', :action => 'edit', :id => @project }, :method => 'post' do |f| %>
:url => { :controller => 'wikis', :action => 'edit', :id => @project } do |f| %>
<%= error_messages_for 'wiki' %>

View File

@@ -1,5 +1,5 @@
<h2><%= l(:label_repository) %></h2>
<%= labelled_form_for :repository, @repository, :url => repository_path(@repository), :html => {:method => :put} do |f| %>
<%= labelled_form_for :repository, @repository, :url => repository_path(@path), :html => {:method => :put} do |f| %>
<%= render :partial => 'form', :locals => {:f => f} %>
<% end %>

View File

@@ -83,7 +83,7 @@
:id => @project,
:repository_id => @repository.identifier_param,
:path => "",
:rev => @changeset.identifier) if @changeset.filechanges.any? %></p>
:rev => @changeset.identifier) if @changeset.changes.any? %></p>
<div class="changeset-changes">
<%= render_changeset_changes %>

View File

@@ -1,7 +1,6 @@
<h2><%= l(:label_spent_time) %></h2>
<%= labelled_form_for @time_entry, :url => time_entries_path do |f| %>
<%= hidden_field_tag 'project_id', params[:project_id] if params[:project_id] %>
<%= render :partial => 'form', :locals => {:f => f} %>
<%= submit_tag l(:button_create) %>
<%= submit_tag l(:button_create_and_continue), :name => 'continue' %>

View File

@@ -3,7 +3,7 @@
<%= select_tag 'user[mail_notification]', options_for_select(user_mail_notification_options(@user), @user.mail_notification),
:onchange => 'if (this.value == "selected") {Element.show("notified-projects")} else {Element.hide("notified-projects")}' %>
</p>
<%= content_tag 'div', :id => 'notified-projects', :style => (@user.mail_notification == 'selected' ? '' : 'display:none;') do %>
<% content_tag 'div', :id => 'notified-projects', :style => (@user.mail_notification == 'selected' ? '' : 'display:none;') do %>
<p><% @user.projects.each do |project| %>
<label><%= check_box_tag 'notified_project_ids[]', project.id, @user.notified_projects_ids.include?(project.id) %> <%=h project.name %></label><br />
<% end %></p>

View File

@@ -4,15 +4,6 @@ Redmine - project management software
Copyright (C) 2006-2012 Jean-Philippe Lang
http://www.redmine.org/
== 2012-06-05 v2.0.2
* Defect #11032: Project list is not shown when "For any event on the selected projects only..." is selected on user edit panel
* Defect #11038: "Create and continue" should preserve project, issue and activity when logging time
* Defect #11046: Redmine.pm does not support "bind as user" ldap authentication
* Defect #11051: reposman.rb fails in 1.4.2 because of missing require for rubygems
* Defect #11085: Wiki start page can't be changed
* Feature #11084: Update Rails to 3.2.5
== 2012-05-28 v2.0.1
* Defect #10923: After creating a new Version Redmine jumps back to "Information"

View File

@@ -366,19 +366,12 @@ sub is_member {
);
$sthldap->execute($auth_source_id);
while (my @rowldap = $sthldap->fetchrow_array) {
my $bind_as = $rowldap[3] ? $rowldap[3] : "";
my $bind_pw = $rowldap[4] ? $rowldap[4] : "";
if ($bind_as =~ m/\$login/) {
# replace $login with $redmine_user and use $redmine_pass
$bind_as =~ s/\$login/$redmine_user/g;
$bind_pw = $redmine_pass
}
my $ldap = Authen::Simple::LDAP->new(
host => ($rowldap[2] eq "1" || $rowldap[2] eq "t") ? "ldaps://$rowldap[0]:$rowldap[1]" : $rowldap[0],
port => $rowldap[1],
basedn => $rowldap[5],
binddn => $bind_as,
bindpw => $bind_pw,
binddn => $rowldap[3] ? $rowldap[3] : "",
bindpw => $rowldap[4] ? $rowldap[4] : "",
filter => "(".$rowldap[6]."=%s)"
);
my $method = $r->method;

View File

@@ -3,7 +3,6 @@
require 'optparse'
require 'find'
require 'etc'
require 'rubygems'
Version = "1.4"
SUPPORTED_SCM = %w( Subversion Darcs Mercurial Bazaar Git Filesystem )

View File

@@ -4,7 +4,7 @@ module Redmine
module VERSION #:nodoc:
MAJOR = 2
MINOR = 0
TINY = 2
TINY = 1
# Branch values:
# * official release: nil

View File

@@ -163,7 +163,7 @@ namespace :redmine do
set_inheritance_column :none
# ticket changes: only migrate status changes and comments
has_many :ticket_changes, :class_name => "TracTicketChange", :foreign_key => :ticket
has_many :changes, :class_name => "TracTicketChange", :foreign_key => :ticket
has_many :customs, :class_name => "TracTicketCustom", :foreign_key => :ticket
def attachments
@@ -487,7 +487,7 @@ namespace :redmine do
end
# Comments and status/resolution changes
ticket.ticket_changes.group_by(&:time).each do |time, changeset|
ticket.changes.group_by(&:time).each do |time, changeset|
status_change = changeset.select {|change| change.field == 'status'}.first
resolution_change = changeset.select {|change| change.field == 'resolution'}.first
comment_change = changeset.select {|change| change.field == 'comment'}.first

View File

@@ -44,7 +44,6 @@ class TimelogControllerTest < ActionController::TestCase
# Default activity selected
assert_tag :tag => 'option', :attributes => { :selected => 'selected' },
:content => 'Development'
assert_select 'input[name=project_id][value=1]'
end
def test_get_new_should_only_show_active_time_entry_activities
@@ -62,18 +61,6 @@ class TimelogControllerTest < ActionController::TestCase
assert_response :success
assert_template 'new'
assert_tag 'select', :attributes => {:name => 'time_entry[project_id]'}
assert_select 'input[name=project_id]', 0
end
def test_new_without_project_should_prefill_the_form
@request.session[:user_id] = 3
get :new, :time_entry => {:project_id => '1'}
assert_response :success
assert_template 'new'
assert_select 'select[name=?]', 'time_entry[project_id]' do
assert_select 'option[value=1][selected=selected]'
end
assert_select 'input[name=project_id]', 0
end
def test_new_without_project_should_deny_without_permission
@@ -157,7 +144,7 @@ class TimelogControllerTest < ActionController::TestCase
:spent_on => '2008-03-14',
:hours => '7.3'},
:continue => '1'
assert_redirected_to '/projects/ecookbook/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D='
assert_redirected_to '/projects/ecookbook/time_entries/new'
end
def test_create_and_continue_with_issue_id
@@ -168,7 +155,7 @@ class TimelogControllerTest < ActionController::TestCase
:spent_on => '2008-03-14',
:hours => '7.3'},
:continue => '1'
assert_redirected_to '/projects/ecookbook/issues/1/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=1'
assert_redirected_to '/projects/ecookbook/issues/1/time_entries/new'
end
def test_create_and_continue_without_project
@@ -180,7 +167,7 @@ class TimelogControllerTest < ActionController::TestCase
:hours => '7.3'},
:continue => '1'
assert_redirected_to '/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=&time_entry%5Bproject_id%5D=1'
assert_redirected_to '/time_entries/new'
end
def test_create_without_log_time_permission_should_be_denied

View File

@@ -311,29 +311,6 @@ class UsersControllerTest < ActionController::TestCase
assert u.check_password?('newpass')
end
def test_update_notified_project
get :edit, :id => 2
assert_response :success
assert_template 'edit'
u = User.find(2)
assert_equal [1, 2, 5], u.projects.collect{|p| p.id}.sort
assert_equal [1, 2, 5], u.notified_projects_ids.sort
assert_tag :tag => 'input',
:attributes => {
:id => 'notified_project_ids_',
:value => 1,
}
assert_equal 'all', u.mail_notification
put :update, :id => 2,
:user => {
:mail_notification => 'selected',
},
:notified_project_ids => [1, 2]
u = User.find(2)
assert_equal 'selected', u.mail_notification
assert_equal [1, 2], u.notified_projects_ids.sort
end
def test_destroy
assert_difference 'User.count', -1 do
delete :destroy, :id => 2

View File

@@ -97,7 +97,7 @@ class GroupTest < ActiveSupport::TestCase
def test_roles_removed_when_removing_user_from_group
assert User.find(8).member_of?(Project.find(5))
User.find(8).groups = []
User.find(8).groups.clear
assert !User.find(8).member_of?(Project.find(5))
end

View File

@@ -67,7 +67,7 @@ class RepositoryBazaarTest < ActiveSupport::TestCase
@project.reload
assert_equal NUM_REV, @repository.changesets.count
assert_equal 9, @repository.filechanges.count
assert_equal 9, @repository.changes.count
assert_equal 'Initial import', @repository.changesets.find_by_revision('1').comments
end

View File

@@ -102,7 +102,7 @@ class RepositoryCvsTest < ActiveSupport::TestCase
@project.reload
assert_equal CHANGESETS_NUM, @repository.changesets.count
assert_equal 16, @repository.filechanges.count
assert_equal 16, @repository.changes.count
assert_not_nil @repository.changesets.find_by_comments('Two files changed')
r2 = @repository.changesets.find_by_revision('2')

View File

@@ -68,7 +68,7 @@ class RepositoryDarcsTest < ActiveSupport::TestCase
@project.reload
assert_equal NUM_REV, @repository.changesets.count
assert_equal 13, @repository.filechanges.count
assert_equal 13, @repository.changes.count
assert_equal "Initial commit.", @repository.changesets.find_by_revision('1').comments
end

View File

@@ -62,11 +62,11 @@ class RepositoryFilesystemTest < ActiveSupport::TestCase
if File.directory?(REPOSITORY_PATH)
def test_fetch_changesets
assert_equal 0, @repository.changesets.count
assert_equal 0, @repository.filechanges.count
assert_equal 0, @repository.changes.count
@repository.fetch_changesets
@project.reload
assert_equal 0, @repository.changesets.count
assert_equal 0, @repository.filechanges.count
assert_equal 0, @repository.changes.count
end
def test_entries

View File

@@ -101,7 +101,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
@project.reload
assert_equal NUM_REV, @repository.changesets.count
assert_equal 39, @repository.filechanges.count
assert_equal 39, @repository.changes.count
commit = @repository.changesets.find_by_revision("7234cb2750b63f47bff735edc50a1c0a433c2518")
assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", commit.scmid
@@ -111,8 +111,8 @@ class RepositoryGitTest < ActiveSupport::TestCase
# TODO: add a commit with commit time <> author time to the test repository
assert_equal "2007-12-14 09:22:52".to_time, commit.committed_on
assert_equal "2007-12-14".to_date, commit.commit_date
assert_equal 3, commit.filechanges.count
change = commit.filechanges.sort_by(&:path).first
assert_equal 3, commit.changes.count
change = commit.changes.sort_by(&:path).first
assert_equal "README", change.path
assert_equal nil, change.from_path
assert_equal "A", change.action

View File

@@ -86,7 +86,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
assert_equal 46, @repository.filechanges.count
assert_equal 46, @repository.changes.count
assert_equal "Initial import.\nThe repository contains 3 files.",
@repository.changesets.find_by_revision('0').comments
end
@@ -214,7 +214,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
cs1 = @repository.changesets.find_by_revision('13')
assert_not_nil cs1
c1 = cs1.filechanges.sort_by(&:path)
c1 = cs1.changes.sort_by(&:path)
assert_equal 2, c1.size
assert_equal 'A', c1[0].action
@@ -227,7 +227,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
assert_equal '/sql_escape/underscore_dir/understrike_file.txt', c1[1].from_path
cs2 = @repository.changesets.find_by_revision('15')
c2 = cs2.filechanges
c2 = cs2.changes
assert_equal 1, c2.size
assert_equal 'A', c2[0].action
@@ -236,7 +236,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
assert_equal '933ca60293d7', c2[0].from_revision
cs3 = @repository.changesets.find_by_revision('19')
c3 = cs3.filechanges
c3 = cs3.changes
assert_equal 1, c3.size
assert_equal 'A', c3[0].action
assert_equal "/latin-1-dir/test-#{@char_1}-1.txt", c3[0].path

View File

@@ -36,7 +36,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
@project.reload
assert_equal NUM_REV, @repository.changesets.count
assert_equal 20, @repository.filechanges.count
assert_equal 20, @repository.changes.count
assert_equal 'Initial import.', @repository.changesets.find_by_revision('1').comments
end
@@ -99,7 +99,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
@project.reload
assert_equal 1, @repository.changesets.count, 'Expected to see 1 revision'
assert_equal 2, @repository.filechanges.count, 'Expected to see 2 changes, dir add and file add'
assert_equal 2, @repository.changes.count, 'Expected to see 2 changes, dir add and file add'
entries = @repository.entries('')
assert_not_nil entries, 'Expect to find entries'

View File

@@ -98,10 +98,8 @@ class RepositoryTest < ActiveSupport::TestCase
end
def test_destroy
repository = Repository.find(10)
changesets = repository.changesets.count
changes = repository.filechanges.count
changesets = Changeset.where("repository_id = 10").all.count
changes = Changeset.joins([:changes]).where("repository_id = 10").all.count
assert_difference 'Changeset.count', -changesets do
assert_difference 'Change.count', -changes do
Repository.find(10).destroy