From 4f6b337f5cf76318348103adfac666bb5d669a7e Mon Sep 17 00:00:00 2001 From: MAEDA Go Date: Mon, 10 Jul 2017 11:07:15 +0900 Subject: [PATCH] Drop Darcs support. --- app/helpers/repositories_helper.rb | 11 +- app/models/repository/darcs.rb | 114 ---------- config/configuration.yml.example | 3 - config/settings.yml | 1 - extra/svn/reposman.rb | 8 +- lib/redmine.rb | 1 - lib/redmine/scm/adapters/darcs_adapter.rb | 239 --------------------- lib/tasks/testing.rake | 2 +- test/fixtures/repositories/darcs_repository.tar.gz | Bin 8075 -> 0 bytes .../repositories_darcs_controller_test.rb | 178 --------------- test/unit/helpers/application_helper_test.rb | 26 --- .../lib/redmine/scm/adapters/darcs_adapter_test.rb | 60 ------ test/unit/repository_darcs_test.rb | 129 ----------- test/unit/repository_test.rb | 8 +- 14 files changed, 10 insertions(+), 770 deletions(-) delete mode 100644 app/models/repository/darcs.rb delete mode 100644 lib/redmine/scm/adapters/darcs_adapter.rb delete mode 100644 test/fixtures/repositories/darcs_repository.tar.gz delete mode 100644 test/functional/repositories_darcs_controller_test.rb delete mode 100644 test/unit/lib/redmine/scm/adapters/darcs_adapter_test.rb delete mode 100644 test/unit/repository_darcs_test.rb diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 4778c79a1..314c0b29b 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -157,15 +157,6 @@ module RepositoriesHelper :onchange => "this.name='repository[password]';")) end - def darcs_field_tags(form, repository) - content_tag('p', form.text_field( - :url, :label => l(:field_path_to_repository), - :size => 60, :required => true, - :disabled => !repository.safe_attribute?('url')) + - scm_path_info_tag(repository)) + - scm_log_encoding_tag(form, repository) - end - def mercurial_field_tags(form, repository) content_tag('p', form.text_field( :url, :label => l(:field_path_to_repository), @@ -279,7 +270,7 @@ module RepositoriesHelper } end heads.sort! { |head1, head2| head1.to_s <=> head2.to_s } - space = nil + space = nil heads.each do |head| if commits_by_scmid.include? head.scmid space = index_head((space || -1) + 1, head, commits_by_scmid) diff --git a/app/models/repository/darcs.rb b/app/models/repository/darcs.rb deleted file mode 100644 index 8c1302ca2..000000000 --- a/app/models/repository/darcs.rb +++ /dev/null @@ -1,114 +0,0 @@ -# Redmine - project management software -# Copyright (C) 2006-2017 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 -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# 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. -# -# 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. - -require 'redmine/scm/adapters/darcs_adapter' - -class Repository::Darcs < Repository - validates_presence_of :url, :log_encoding - - def self.human_attribute_name(attribute_key_name, *args) - attr_name = attribute_key_name.to_s - if attr_name == "url" - attr_name = "path_to_repository" - end - super(attr_name, *args) - end - - def self.scm_adapter_class - Redmine::Scm::Adapters::DarcsAdapter - end - - def self.scm_name - 'Darcs' - end - - def supports_directory_revisions? - true - end - - def entry(path=nil, identifier=nil) - patch = identifier.nil? ? nil : changesets.find_by_revision(identifier) - scm.entry(path, patch.nil? ? nil : patch.scmid) - end - - def scm_entries(path=nil, identifier=nil) - patch = nil - if ! identifier.nil? - patch = changesets.find_by_revision(identifier) - return nil if patch.nil? - end - entries = scm.entries(path, patch.nil? ? nil : patch.scmid) - if entries - entries.each do |entry| - # Search the DB for the entry's last change - if entry.lastrev && !entry.lastrev.scmid.blank? - changeset = changesets.find_by_scmid(entry.lastrev.scmid) - end - if changeset - entry.lastrev.identifier = changeset.revision - entry.lastrev.name = changeset.revision - entry.lastrev.time = changeset.committed_on - entry.lastrev.author = changeset.committer - end - end - end - entries - end - protected :scm_entries - - def cat(path, identifier=nil) - patch = identifier.nil? ? nil : changesets.find_by_revision(identifier.to_s) - scm.cat(path, patch.nil? ? nil : patch.scmid) - end - - def diff(path, rev, rev_to) - patch_from = changesets.find_by_revision(rev) - 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(' ') - end - patch_from ? scm.diff(path, patch_from.scmid, patch_to ? patch_to.scmid : nil) : nil - end - - def fetch_changesets - scm_info = scm.info - if scm_info - db_last_id = latest_changeset ? latest_changeset.scmid : nil - next_rev = latest_changeset ? latest_changeset.revision.to_i + 1 : 1 - # latest revision in the repository - scm_revision = scm_info.lastrev.scmid - unless changesets.find_by_scmid(scm_revision) - revisions = scm.revisions('', db_last_id, nil, :with_path => true) - transaction do - revisions.reverse_each do |revision| - changeset = Changeset.create(:repository => self, - :revision => next_rev, - :scmid => revision.scmid, - :committer => revision.author, - :committed_on => revision.time, - :comments => revision.message) - revision.paths.each do |change| - changeset.create_change(change) - end - next_rev += 1 - end if revisions - end - end - end - end -end diff --git a/config/configuration.yml.example b/config/configuration.yml.example index 3522ef695..e44e3c163 100644 --- a/config/configuration.yml.example +++ b/config/configuration.yml.example @@ -99,14 +99,12 @@ default: # scm_git_command: /usr/local/bin/git # (default: git) # scm_cvs_command: cvs # (default: cvs) # scm_bazaar_command: bzr.exe # (default: bzr) - # scm_darcs_command: darcs-1.0.9-i386-linux # (default: darcs) # scm_subversion_command: scm_mercurial_command: scm_git_command: scm_cvs_command: scm_bazaar_command: - scm_darcs_command: # SCM paths validation. # @@ -132,7 +130,6 @@ default: scm_git_path_regexp: scm_cvs_path_regexp: scm_bazaar_path_regexp: - scm_darcs_path_regexp: scm_filesystem_path_regexp: # Absolute path to the SCM commands errors (stderr) log file. diff --git a/config/settings.yml b/config/settings.yml index 2a4ab1d75..c9f2c680e 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -119,7 +119,6 @@ enabled_scm: serialized: true default: - Subversion - - Darcs - Mercurial - Cvs - Bazaar diff --git a/extra/svn/reposman.rb b/extra/svn/reposman.rb index 4f748acf0..6bf289593 100755 --- a/extra/svn/reposman.rb +++ b/extra/svn/reposman.rb @@ -6,7 +6,7 @@ require 'etc' require 'rubygems' Version = "1.5" -SUPPORTED_SCM = %w( Subversion Darcs Mercurial Bazaar Git Filesystem ) +SUPPORTED_SCM = %w( Subversion Mercurial Bazaar Git Filesystem ) $verbose = 0 $quiet = false @@ -71,7 +71,7 @@ optparse = OptionParser.new do |opts| opts.separator("") opts.separator("Manages your repositories with Redmine.") opts.separator("") - opts.separator("Required arguments:") + opts.separator("Required arguments:") opts.on("-s", "--svn-dir DIR", "use DIR as base directory for svn repositories") {|v| $repos_base = v} opts.on("-r", "--redmine-host HOST","assume Redmine is hosted on HOST. Examples:", " -r redmine.example.net", @@ -81,7 +81,7 @@ optparse = OptionParser.new do |opts| "(you can use --key-file option as an alternative)") {|v| $api_key = v} opts.separator("") opts.separator("Options:") - opts.on("-o", "--owner OWNER", "owner of the repository. using the rails login", + opts.on("-o", "--owner OWNER", "owner of the repository. using the rails login", "allows users to browse the repository within", "Redmine even for private projects. If you want to", "share repositories through Redmine.pm, you need", @@ -109,7 +109,7 @@ optparse = OptionParser.new do |opts| "This command override the default creation for", "git and subversion.") {|v| $command = v} opts.on( "--key-file FILE", "path to a file that contains the Redmine API key", - "(use this option instead of --key if you don't", + "(use this option instead of --key if you don't", "want the key to appear in the command line)") {|v| read_key_from_file(v)} opts.on("-t", "--test", "only show what should be done") {$test = true} opts.on("-f", "--force", "force repository creation even if the project", "repository is already declared in Redmine") {$force = true} diff --git a/lib/redmine.rb b/lib/redmine.rb index 7773e3875..29d96c2b0 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -66,7 +66,6 @@ require 'redmine/hook/view_listener' require 'redmine/plugin' Redmine::Scm::Base.add "Subversion" -Redmine::Scm::Base.add "Darcs" Redmine::Scm::Base.add "Mercurial" Redmine::Scm::Base.add "Cvs" Redmine::Scm::Base.add "Bazaar" diff --git a/lib/redmine/scm/adapters/darcs_adapter.rb b/lib/redmine/scm/adapters/darcs_adapter.rb deleted file mode 100644 index dd0f4f5d3..000000000 --- a/lib/redmine/scm/adapters/darcs_adapter.rb +++ /dev/null @@ -1,239 +0,0 @@ -# Redmine - project management software -# Copyright (C) 2006-2017 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 -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# 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. -# -# 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. - -require 'redmine/scm/adapters/abstract_adapter' -require 'rexml/document' - -module Redmine - module Scm - module Adapters - class DarcsAdapter < AbstractAdapter - # Darcs executable name - DARCS_BIN = Redmine::Configuration['scm_darcs_command'] || "darcs" - - class << self - def client_command - @@bin ||= DARCS_BIN - end - - def sq_bin - @@sq_bin ||= shell_quote_command - end - - def client_version - @@client_version ||= (darcs_binary_version || []) - end - - def client_available - !client_version.empty? - end - - def darcs_binary_version - darcsversion = darcs_binary_version_from_command_line.dup.force_encoding('ASCII-8BIT') - if m = darcsversion.match(%r{\A(.*?)((\d+\.)+\d+)}) - m[2].scan(%r{\d+}).collect(&:to_i) - end - end - - def darcs_binary_version_from_command_line - shellout("#{sq_bin} --version") { |io| io.read }.to_s - end - end - - def initialize(url, root_url=nil, login=nil, password=nil, - path_encoding=nil) - @url = url - @root_url = url - end - - def supports_cat? - # cat supported in darcs 2.0.0 and higher - self.class.client_version_above?([2, 0, 0]) - end - - # Get info about the darcs repository - def info - rev = revisions(nil,nil,nil,{:limit => 1}) - rev ? Info.new({:root_url => @url, :lastrev => rev.last}) : nil - end - - # Returns an Entries collection - # or nil if the given path doesn't exist in the repository - def entries(path=nil, identifier=nil, options={}) - path_prefix = (path.blank? ? '' : "#{path}/") - if path.blank? - path = ( self.class.client_version_above?([2, 2, 0]) ? @url : '.' ) - end - entries = Entries.new - cmd = "#{self.class.sq_bin} annotate --repodir #{shell_quote @url} --xml-output" - cmd << " --match #{shell_quote("hash #{identifier}")}" if identifier - cmd << " #{shell_quote path}" - shellout(cmd) do |io| - begin - doc = REXML::Document.new(io) - if doc.root.name == 'directory' - doc.elements.each('directory/*') do |element| - next unless ['file', 'directory'].include? element.name - entries << entry_from_xml(element, path_prefix) - end - elsif doc.root.name == 'file' - entries << entry_from_xml(doc.root, path_prefix) - end - rescue - end - end - return nil if $? && $?.exitstatus != 0 - entries.compact! - entries.sort_by_name - end - - def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={}) - path = '.' if path.blank? - revisions = Revisions.new - cmd = "#{self.class.sq_bin} changes --repodir #{shell_quote @url} --xml-output" - cmd << " --from-match #{shell_quote("hash #{identifier_from}")}" if identifier_from - cmd << " --last #{options[:limit].to_i}" if options[:limit] - shellout(cmd) do |io| - begin - doc = REXML::Document.new(io) - doc.elements.each("changelog/patch") do |patch| - message = patch.elements['name'].text - message << "\n" + patch.elements['comment'].text.gsub(/\*\*\*END OF DESCRIPTION\*\*\*.*\z/m, '') if patch.elements['comment'] - revisions << Revision.new({:identifier => nil, - :author => patch.attributes['author'], - :scmid => patch.attributes['hash'], - :time => Time.parse(patch.attributes['local_date']), - :message => message, - :paths => (options[:with_path] ? get_paths_for_patch(patch.attributes['hash']) : nil) - }) - end - rescue - end - end - return nil if $? && $?.exitstatus != 0 - revisions - end - - def diff(path, identifier_from, identifier_to=nil) - path = '*' if path.blank? - cmd = "#{self.class.sq_bin} diff --repodir #{shell_quote @url}" - if identifier_to.nil? - cmd << " --match #{shell_quote("hash #{identifier_from}")}" - else - cmd << " --to-match #{shell_quote("hash #{identifier_from}")}" - cmd << " --from-match #{shell_quote("hash #{identifier_to}")}" - end - cmd << " -u #{shell_quote path}" - diff = [] - shellout(cmd) do |io| - io.each_line do |line| - diff << line - end - end - return nil if $? && $?.exitstatus != 0 - diff - end - - def cat(path, identifier=nil) - cmd = "#{self.class.sq_bin} show content --repodir #{shell_quote @url}" - cmd << " --match #{shell_quote("hash #{identifier}")}" if identifier - cmd << " #{shell_quote path}" - cat = nil - shellout(cmd) do |io| - io.binmode - cat = io.read - end - return nil if $? && $?.exitstatus != 0 - cat - end - - private - - # Returns an Entry from the given XML element - # or nil if the entry was deleted - def entry_from_xml(element, path_prefix) - modified_element = element.elements['modified'] - if modified_element.elements['modified_how'].text.match(/removed/) - return nil - end - - Entry.new({:name => element.attributes['name'], - :path => path_prefix + element.attributes['name'], - :kind => element.name == 'file' ? 'file' : 'dir', - :size => nil, - :lastrev => Revision.new({ - :identifier => nil, - :scmid => modified_element.elements['patch'].attributes['hash'] - }) - }) - end - - def get_paths_for_patch(hash) - paths = get_paths_for_patch_raw(hash) - if self.class.client_version_above?([2, 4]) - orig_paths = paths - paths = [] - add_paths = [] - add_paths_name = [] - mod_paths = [] - other_paths = [] - orig_paths.each do |path| - if path[:action] == 'A' - add_paths << path - add_paths_name << path[:path] - elsif path[:action] == 'M' - mod_paths << path - else - other_paths << path - end - end - add_paths_name.each do |add_path| - mod_paths.delete_if { |m| m[:path] == add_path } - end - paths.concat add_paths - paths.concat mod_paths - paths.concat other_paths - end - paths - end - - # Retrieve changed paths for a single patch - def get_paths_for_patch_raw(hash) - cmd = "#{self.class.sq_bin} annotate --repodir #{shell_quote @url} --summary --xml-output" - cmd << " --match #{shell_quote("hash #{hash}")} " - paths = [] - shellout(cmd) do |io| - begin - # Darcs xml output has multiple root elements in this case (tested with darcs 1.0.7) - # A root element is added so that REXML doesn't raise an error - doc = REXML::Document.new("" + io.read + "") - doc.elements.each('fake_root/summary/*') do |modif| - paths << {:action => modif.name[0,1].upcase, - :path => "/" + modif.text.chomp.gsub(/^\s*/, '') - } - end - rescue - end - end - paths - rescue CommandFailed - paths - end - end - end - end -end diff --git a/lib/tasks/testing.rake b/lib/tasks/testing.rake index 831f4d316..4b5813089 100644 --- a/lib/tasks/testing.rake +++ b/lib/tasks/testing.rake @@ -26,7 +26,7 @@ namespace :test do FileUtils.mkdir_p Rails.root + '/tmp/test' end - supported_scms = [:subversion, :cvs, :bazaar, :mercurial, :git, :darcs, :filesystem] + supported_scms = [:subversion, :cvs, :bazaar, :mercurial, :git, :filesystem] desc "Creates a test subversion repository" task :subversion => :create_dir do diff --git a/test/fixtures/repositories/darcs_repository.tar.gz b/test/fixtures/repositories/darcs_repository.tar.gz deleted file mode 100644 index ba4d8d04c466eab54f26fa7fffd2927a44b15fb1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8075 zcmV;6A9Ua!iwFqk8Pi7q3uIw(V{>0}WpHnEX>@OLc`kHeascc(2V4_p`%z1gWl?cp z9fyE`gqWRxS_ufUHwZ4gB$sfK<>eR=aUxZQ;6SBPt0)%KsHlh_I1q7FidCVG(t#F5 z1wn17qxs$oi0iY~|K}fn|L@NOm-pWBjQ4r&8TXzL#stbp3{l9HC@#lT<47MKASRW= z;Xova0P1UPXNN}Ru$gQclS8LN5RJ}eFi8;We?gWvAV!J97zBY9!TxTY7?Z~+xx)VN2RbBQGU?J;C<}RU^9UInKUZB$Nt>`Z?nG;ksvriQOLyqIS(3@%4W0QZht0? z_QL*54zNF)MrV;A>VMAq-SGe1{wo6frkEHGGX%FLo*t8fK>HcEjQjQhzbQFGYC%KB z-NJEK41sY}E`vf)DMC`hQVPU^q%aE6sZ;X@Q6^7NJayQtJe=dEqDqBKN0hMc_dO{hS5`4j}RchC&W!lB55?5 zw6vVY#zw7HJ7wfkfJf?u2l)k)oPYmO1Ug*L$-I#GtBL8nek5w&icd6J&i8H`t{^ur zEw{*pjhR0n?VCau86}Nc+s+-^FgxsS!3_D`n#bAK5NWUeUvH?nK`6k}&2RE2_pzn<$Uq9#=v#w0q3X!^g7%D0hboLb>{8~AHacApo!U0q zz@y20`TkamPplq3Vuk)_@@sGBBgy+REv^R`B+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!6*5^S3|Dv|E2)2!U;fl z-&npqxB@>qSinJ`N>mD#bUU4aONyjzr~A% z@(5S=_loNi2IuMP6Y<_59CE~h3%>uWCL)GHBw)WS@-(-FZW8pTp$BZZ5@!e!LZbI; z0$ms921(wOSQz5X5-{GgK&YPsct>6}?!G~MrWm$XOnI*GeSv^al0a}ufaMFlmp4lg zz~*v%aHc!~CmdESNsxE~TFW4WOeM+BHBORx?~I2Vy; zVE+IADtheyzrgnZdhh?ALZM>M{}lq}|Nq}jkNW=wz6a3z`9CUr1~&hr2tK*}`|v%0 z-uwS25iGI!e}#bg|Hu6QWB&g!|Nof(|9_|de+&!^3=9km3=9km3=9km3=9km3=9km Z3=9km3=9km42-`w{{;gOQ;h(i006{M#a;ja diff --git a/test/functional/repositories_darcs_controller_test.rb b/test/functional/repositories_darcs_controller_test.rb deleted file mode 100644 index dc2800f85..000000000 --- a/test/functional/repositories_darcs_controller_test.rb +++ /dev/null @@ -1,178 +0,0 @@ -# Redmine - project management software -# Copyright (C) 2006-2017 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 -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# 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. -# -# 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. - -require File.expand_path('../../test_helper', __FILE__) - -class RepositoriesDarcsControllerTest < Redmine::ControllerTest - tests RepositoriesController - - fixtures :projects, :users, :email_addresses, :roles, :members, :member_roles, - :repositories, :enabled_modules - - REPOSITORY_PATH = Rails.root.join('tmp/test/darcs_repository').to_s - PRJ_ID = 3 - NUM_REV = 6 - - def setup - User.current = nil - @project = Project.find(PRJ_ID) - @repository = Repository::Darcs.create( - :project => @project, - :url => REPOSITORY_PATH, - :log_encoding => 'UTF-8' - ) - assert @repository - end - - if File.directory?(REPOSITORY_PATH) - def test_get_new - @request.session[:user_id] = 1 - @project.repository.destroy - get :new, :params => { - :project_id => 'subproject1', - :repository_scm => 'Darcs' - } - assert_response :success - assert_select 'select[name=?]', 'repository_scm' do - assert_select 'option[value=?][selected=selected]', 'Darcs' - end - end - - def test_browse_root - assert_equal 0, @repository.changesets.count - @repository.fetch_changesets - @project.reload - assert_equal NUM_REV, @repository.changesets.count - get :show, :params => { - :id => PRJ_ID - } - assert_select 'table.entries tbody' do - assert_select 'tr', 3 - assert_select 'tr.dir td.filename a', :text => 'images' - assert_select 'tr.dir td.filename a', :text => 'sources' - assert_select 'tr.file td.filename a', :text => 'README' - end - end - - def test_browse_directory - assert_equal 0, @repository.changesets.count - @repository.fetch_changesets - @project.reload - assert_equal NUM_REV, @repository.changesets.count - get :show, :params => { - :id => PRJ_ID, - :path => repository_path_hash(['images'])[:param] - } - assert_response :success - assert_select 'table.entries tbody' do - assert_select 'tr', 2 - assert_select 'tr.file td.filename a', :text => 'delete.png' - assert_select 'tr.file td.filename a', :text => 'edit.png' - end - end - - def test_browse_at_given_revision - assert_equal 0, @repository.changesets.count - @repository.fetch_changesets - @project.reload - assert_equal NUM_REV, @repository.changesets.count - get :show, :params => { - :id => PRJ_ID, - :path => repository_path_hash(['images'])[:param], - :rev => 1 - } - assert_response :success - assert_select 'table.entries tbody' do - assert_select 'tr', 1 - assert_select 'tr.file td.filename a', :text => 'delete.png' - end - end - - def test_changes - assert_equal 0, @repository.changesets.count - @repository.fetch_changesets - @project.reload - assert_equal NUM_REV, @repository.changesets.count - get :changes, :params => { - :id => PRJ_ID, - :path => repository_path_hash(['images', 'edit.png'])[:param] - } - assert_response :success - assert_select 'h2', :text => /edit.png/ - end - - def test_diff - assert_equal 0, @repository.changesets.count - @repository.fetch_changesets - @project.reload - assert_equal NUM_REV, @repository.changesets.count - # Full diff of changeset 5 - ['inline', 'sbs'].each do |dt| - get :diff, :params => { - :id => PRJ_ID, - :rev => 5, - :type => dt - } - assert_response :success - # Line 22 removed - assert_select 'th.line-num:contains(22) ~ td.diff_out', :text => /def remove/ - end - end - - def test_destroy_valid_repository - @request.session[:user_id] = 1 # admin - assert_equal 0, @repository.changesets.count - @repository.fetch_changesets - @project.reload - assert_equal NUM_REV, @repository.changesets.count - - assert_difference 'Repository.count', -1 do - delete :destroy, :params => { - :id => @repository.id - } - end - assert_response 302 - @project.reload - assert_nil @project.repository - end - - def test_destroy_invalid_repository - @request.session[:user_id] = 1 # admin - @project.repository.destroy - @repository = Repository::Darcs.create!( - :project => @project, - :url => "/invalid", - :log_encoding => 'UTF-8' - ) - @repository.fetch_changesets - @project.reload - assert_equal 0, @repository.changesets.count - - assert_difference 'Repository.count', -1 do - delete :destroy, :params => { - :id => @repository.id - } - end - assert_response 302 - @project.reload - assert_nil @project.repository - end - else - puts "Darcs test repository NOT FOUND. Skipping functional tests !!!" - def test_fake; assert true end - end -end diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 020b4636c..9da13d7ec 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -606,32 +606,6 @@ RAW end # TODO: Bazaar commit id contains mail address, so it contains '@' and '_'. - def test_redmine_links_darcs_commit - changeset_link = link_to('20080308225258-98289-abcd456efg.gz', - { - :controller => 'repositories', - :action => 'revision', - :id => 'subproject1', - :rev => '123', - }, - :class => 'changeset', :title => 'test commit') - to_test = { - 'commit:20080308225258-98289-abcd456efg.gz' => changeset_link, - } - @project = Project.find(3) - r = Repository::Darcs.create!( - :project => @project, :url => '/tmp/test/darcs', - :log_encoding => 'UTF-8') - assert r - c = Changeset.new(:repository => r, - :committed_on => Time.now, - :revision => '123', - :scmid => '20080308225258-98289-abcd456efg.gz', - :comments => 'test commit') - assert( c.save ) - to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text) } - end - def test_redmine_links_mercurial_commit changeset_link_rev = link_to('r123', { diff --git a/test/unit/lib/redmine/scm/adapters/darcs_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/darcs_adapter_test.rb deleted file mode 100644 index 949779bf3..000000000 --- a/test/unit/lib/redmine/scm/adapters/darcs_adapter_test.rb +++ /dev/null @@ -1,60 +0,0 @@ -# Redmine - project management software -# Copyright (C) 2006-2017 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 -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# 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. -# -# 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. - -require File.expand_path('../../../../../../test_helper', __FILE__) - -class DarcsAdapterTest < ActiveSupport::TestCase - REPOSITORY_PATH = Rails.root.join('tmp/test/darcs_repository').to_s - - if File.directory?(REPOSITORY_PATH) - def setup - @adapter = Redmine::Scm::Adapters::DarcsAdapter.new(REPOSITORY_PATH) - end - - def test_darcsversion - to_test = { "1.0.9 (release)\n" => [1,0,9] , - "2.2.0 (release)\n" => [2,2,0] } - to_test.each do |s, v| - test_darcsversion_for(s, v) - end - end - - def test_revisions - id1 = '20080308225258-98289-761f654d669045eabee90b91b53a21ce5593cadf.gz' - revs = @adapter.revisions('', nil, nil, {:with_path => true}) - assert_equal 6, revs.size - assert_equal id1, revs[5].scmid - paths = revs[5].paths - assert_equal 5, paths.size - assert_equal 'A', paths[0][:action] - assert_equal '/README', paths[0][:path] - assert_equal 'A', paths[1][:action] - assert_equal '/images', paths[1][:path] - end - - private - - def test_darcsversion_for(darcsversion, version) - @adapter.class.expects(:darcs_binary_version_from_command_line).returns(darcsversion) - assert_equal version, @adapter.class.darcs_binary_version - end - - else - puts "Darcs test repository NOT FOUND. Skipping unit tests !!!" - def test_fake; assert true end - end -end diff --git a/test/unit/repository_darcs_test.rb b/test/unit/repository_darcs_test.rb deleted file mode 100644 index 5cb572503..000000000 --- a/test/unit/repository_darcs_test.rb +++ /dev/null @@ -1,129 +0,0 @@ -# Redmine - project management software -# Copyright (C) 2006-2017 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 -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# 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. -# -# 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. - -require File.expand_path('../../test_helper', __FILE__) - -class RepositoryDarcsTest < ActiveSupport::TestCase - fixtures :projects - - include Redmine::I18n - - REPOSITORY_PATH = Rails.root.join('tmp/test/darcs_repository').to_s - NUM_REV = 6 - - def setup - @project = Project.find(3) - @repository = Repository::Darcs.create( - :project => @project, - :url => REPOSITORY_PATH, - :log_encoding => 'UTF-8' - ) - assert @repository - end - - def test_blank_path_to_repository_error_message - set_language_if_valid 'en' - repo = Repository::Darcs.new( - :project => @project, - :identifier => 'test', - :log_encoding => 'UTF-8' - ) - assert !repo.save - assert_include "Path to repository cannot be blank", - repo.errors.full_messages - end - - def test_blank_path_to_repository_error_message_fr - set_language_if_valid 'fr' - str = "Chemin du d\xc3\xa9p\xc3\xb4t doit \xc3\xaatre renseign\xc3\xa9(e)".force_encoding('UTF-8') - repo = Repository::Darcs.new( - :project => @project, - :url => "", - :identifier => 'test', - :log_encoding => 'UTF-8' - ) - assert !repo.save - assert_include str, repo.errors.full_messages - end - - if File.directory?(REPOSITORY_PATH) - def test_fetch_changesets_from_scratch - assert_equal 0, @repository.changesets.count - @repository.fetch_changesets - @project.reload - - assert_equal NUM_REV, @repository.changesets.count - assert_equal 13, @repository.filechanges.count - assert_equal "Initial commit.", @repository.changesets.find_by_revision('1').comments - end - - def test_fetch_changesets_incremental - assert_equal 0, @repository.changesets.count - @repository.fetch_changesets - @project.reload - assert_equal NUM_REV, @repository.changesets.count - - # Remove changesets with revision > 3 - @repository.changesets.each {|c| c.destroy if c.revision.to_i > 3} - @project.reload - @repository.reload - assert_equal 3, @repository.changesets.count - - @repository.fetch_changesets - @project.reload - assert_equal NUM_REV, @repository.changesets.count - end - - def test_entries - entries = @repository.entries - assert_kind_of Redmine::Scm::Adapters::Entries, entries - end - - def test_entries_invalid_revision - assert_equal 0, @repository.changesets.count - @repository.fetch_changesets - @project.reload - assert_equal NUM_REV, @repository.changesets.count - assert_nil @repository.entries('', '123') - end - - def test_deleted_files_should_not_be_listed - assert_equal 0, @repository.changesets.count - @repository.fetch_changesets - @project.reload - assert_equal NUM_REV, @repository.changesets.count - entries = @repository.entries('sources') - assert entries.detect {|e| e.name == 'watchers_controller.rb'} - assert_nil entries.detect {|e| e.name == 'welcome_controller.rb'} - end - - def test_cat - if @repository.scm.supports_cat? - assert_equal 0, @repository.changesets.count - @repository.fetch_changesets - @project.reload - assert_equal NUM_REV, @repository.changesets.count - cat = @repository.cat("sources/welcome_controller.rb", 2) - assert_not_nil cat - assert cat.include?('class WelcomeController < ApplicationController') - end - end - else - puts "Darcs test repository NOT FOUND. Skipping unit tests !!!" - def test_fake; assert true end - end -end diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb index 859b5ca43..e41b54f9b 100644 --- a/test/unit/repository_test.rb +++ b/test/unit/repository_test.rb @@ -221,7 +221,7 @@ class RepositoryTest < ActiveSupport::TestCase def test_should_not_create_with_disabled_scm # disable Subversion - with_settings :enabled_scm => ['Darcs', 'Git'] do + with_settings :enabled_scm => ['Mercurial', 'Git'] do repository = Repository::Subversion.new( :project => Project.find(3), :url => "svn://localhost") assert !repository.save @@ -280,9 +280,9 @@ class RepositoryTest < ActiveSupport::TestCase :project => Project.find( 4 ), :url => '/foo/bar/baz' ) comment = <<-COMMENT - This is a loooooooooooooooooooooooooooong comment - - + This is a loooooooooooooooooooooooooooong comment + + COMMENT changeset = Changeset.new( :comments => comment, :commit_date => Time.now, -- 2.11.0 (Apple Git-81)