remove cvs scm from openproject core

pull/1186/head
Martin Linkhorst 12 years ago
parent 96dacf3150
commit dd9515d745
  1. 2
      .travis.yml
  2. 7
      app/helpers/repositories_helper.rb
  3. 179
      app/models/repository/cvs.rb
  4. 2
      config/configuration.yml.example
  5. 2
      config/locales/bg.yml
  6. 2
      config/locales/bs.yml
  7. 2
      config/locales/ca.yml
  8. 2
      config/locales/cs.yml
  9. 2
      config/locales/da.yml
  10. 2
      config/locales/de.yml
  11. 2
      config/locales/el.yml
  12. 2
      config/locales/en-GB.yml
  13. 2
      config/locales/en.yml
  14. 2
      config/locales/es.yml
  15. 2
      config/locales/eu.yml
  16. 2
      config/locales/fa.yml
  17. 2
      config/locales/fi.yml
  18. 2
      config/locales/fr.yml
  19. 2
      config/locales/gl.yml
  20. 2
      config/locales/he.yml
  21. 2
      config/locales/hr.yml
  22. 2
      config/locales/hu.yml
  23. 2
      config/locales/id.yml
  24. 2
      config/locales/it.yml
  25. 2
      config/locales/ja.yml
  26. 2
      config/locales/ko.yml
  27. 2
      config/locales/lt.yml
  28. 2
      config/locales/lv.yml
  29. 2
      config/locales/mk.yml
  30. 2
      config/locales/mn.yml
  31. 2
      config/locales/nl.yml
  32. 2
      config/locales/no.yml
  33. 2
      config/locales/pl.yml
  34. 2
      config/locales/pt-BR.yml
  35. 2
      config/locales/pt.yml
  36. 2
      config/locales/ro.yml
  37. 2
      config/locales/ru.yml
  38. 2
      config/locales/sk.yml
  39. 2
      config/locales/sl.yml
  40. 2
      config/locales/sr-YU.yml
  41. 2
      config/locales/sr.yml
  42. 2
      config/locales/sv.yml
  43. 2
      config/locales/th.yml
  44. 2
      config/locales/tr.yml
  45. 2
      config/locales/uk.yml
  46. 2
      config/locales/vi.yml
  47. 2
      config/locales/zh-TW.yml
  48. 2
      config/locales/zh.yml
  49. 1
      config/settings.yml
  50. 1
      lib/redmine.rb
  51. 436
      lib/redmine/scm/adapters/cvs_adapter.rb
  52. 2
      lib/tasks/testing.rake
  53. BIN
      test/fixtures/repositories/cvs_repository.tar.gz
  54. 202
      test/functional/repositories_cvs_controller_test.rb
  55. 81
      test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb
  56. 104
      test/unit/repository_cvs_test.rb
  57. 8
      test/unit/repository_test.rb

@ -9,7 +9,7 @@ env:
script: "bundle exec rake"
before_install:
- "sudo apt-get update -qq"
- "sudo apt-get --no-install-recommends install cvs git subversion"
- "sudo apt-get --no-install-recommends install git subversion"
before_script:
- "RAILS_ENV=production bundle exec rake ci:travis:prepare"
branches:

@ -217,13 +217,6 @@ module RepositoriesHelper
'<br />' + l(:text_default_encoding))
end
def cvs_field_tags(form, repository)
content_tag('p', form.text_field(:root_url, :label => :label_cvs_path, :size => 60, :required => true, :disabled => !repository.new_record?)) +
content_tag('p', form.text_field(:url, :label => :label_cvs_module, :size => 30, :required => true, :disabled => !repository.new_record?)) +
content_tag('p', form.select(:log_encoding, [nil] + Setting::ENCODINGS,
:label => l(:setting_commit_logs_encoding), :required => true))
end
def filesystem_field_tags(form, repository)
content_tag('p', form.text_field(:url, :label => :label_filesystem_path, :size => 60, :required => true, :disabled => (repository && !repository.root_url.blank?))) +
content_tag('p', form.select(:path_encoding, [nil] + Setting::ENCODINGS,

@ -1,179 +0,0 @@
#-- encoding: UTF-8
#-- copyright
# ChiliProject is a project management system.
#
# Copyright (C) 2010-2011 the ChiliProject Team
#
# 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.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
require 'redmine/scm/adapters/cvs_adapter'
require 'digest/sha1'
class Repository::Cvs < Repository
validates_presence_of :url, :root_url, :log_encoding
ATTRIBUTE_KEY_NAMES = {
"url" => "CVSROOT",
"root_url" => "Module",
"log_encoding" => "Commit messages encoding",
}
def self.human_attribute_name(attribute_key_name, options = {})
ATTRIBUTE_KEY_NAMES[attribute_key_name] || super
end
def self.scm_adapter_class
Redmine::Scm::Adapters::CvsAdapter
end
def self.scm_name
'CVS'
end
def entry(path=nil, identifier=nil)
rev = identifier.nil? ? nil : changesets.find_by_revision(identifier)
scm.entry(path, rev.nil? ? nil : rev.committed_on)
end
def entries(path=nil, identifier=nil)
rev = identifier.nil? ? nil : changesets.find_by_revision(identifier)
entries = scm.entries(path, rev.nil? ? nil : rev.committed_on)
if entries
entries.each() do |entry|
if ( ! entry.lastrev.nil? ) && ( ! entry.lastrev.revision.nil? )
change=changes.find_by_revision_and_path(
entry.lastrev.revision,
scm.with_leading_slash(entry.path) )
if change
entry.lastrev.identifier = change.changeset.revision
entry.lastrev.revision = change.changeset.revision
entry.lastrev.author = change.changeset.committer
# entry.lastrev.branch = change.branch
end
end
end
end
entries
end
def cat(path, identifier=nil)
rev = identifier.nil? ? nil : changesets.find_by_revision(identifier)
scm.cat(path, rev.nil? ? nil : rev.committed_on)
end
def diff(path, rev, rev_to)
#convert rev to revision. CVS can't handle changesets here
diff=[]
changeset_from=changesets.find_by_revision(rev)
if rev_to.to_i > 0
changeset_to=changesets.find_by_revision(rev_to)
end
changeset_from.changes.each() do |change_from|
revision_from=nil
revision_to=nil
revision_from=change_from.revision if path.nil? || (change_from.path.starts_with? scm.with_leading_slash(path))
if revision_from
if changeset_to
changeset_to.changes.each() do |change_to|
revision_to=change_to.revision if change_to.path==change_from.path
end
end
unless revision_to
revision_to=scm.get_previous_revision(revision_from)
end
file_diff = scm.diff(change_from.path, revision_from, revision_to)
diff = diff + file_diff unless file_diff.nil?
end
end
return diff
end
def fetch_changesets
# some nifty bits to introduce a commit-id with cvs
# natively cvs doesn't provide any kind of changesets, there is only a revision per file.
# we now take a guess using the author, the commitlog and the commit-date.
# last one is the next step to take. the commit-date is not equal for all
# commits in one changeset. cvs update the commit-date when the *,v file was touched. so
# we use a small delta here, to merge all changes belonging to _one_ changeset
time_delta=10.seconds
fetch_since = latest_changeset ? latest_changeset.committed_on : nil
transaction do
tmp_rev_num = 1
scm.revisions('', fetch_since, nil, :with_paths => true) do |revision|
# 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(
scm.with_leading_slash(revision.paths[0][:path]), revision.paths[0][:revision])
cmt = Changeset.normalize_comments(revision.message, repo_log_encoding)
cs = changesets.find(:first, :conditions=>{
:committed_on=>tmp_time - time_delta .. tmp_time + time_delta,
:committer=>revision.author,
:comments=>cmt
})
# create a new changeset....
unless cs
# we use a temporaray revision number here (just for inserting)
# later on, we calculate a continous positive number
tmp_time2 = tmp_time.clone.gmtime
branch = revision.paths[0][:branch]
scmid = branch + "-" + tmp_time2.strftime("%Y%m%d-%H%M%S")
cs = Changeset.create(:repository => self,
:revision => "tmp#{tmp_rev_num}",
:scmid => scmid,
:committer => revision.author,
:committed_on => tmp_time,
:comments => revision.message)
tmp_rev_num += 1
end
#convert CVS-File-States to internal Action-abbrevations
#default action is (M)odified
action="M"
if revision.paths[0][:action]=="Exp" && revision.paths[0][:revision]=="1.1"
action="A" #add-action always at first revision (= 1.1)
elsif revision.paths[0][:action]=="dead"
action="D" #dead-state is similar to Delete
end
Change.create(:changeset => cs,
:action => action,
:path => scm.with_leading_slash(revision.paths[0][:path]),
:revision => revision.paths[0][:revision],
:branch => revision.paths[0][:branch]
)
end
end
# Renumber new changesets in chronological order
changesets.find(
:all, :order => 'committed_on ASC, id ASC', :conditions => "revision LIKE 'tmp%'"
).each do |changeset|
changeset.update_attribute :revision, next_revision_number
end
end # transaction
@current_revision_number = nil
end
private
# Returns the next revision number to assign to a CVS changeset
def next_revision_number
# Need to retrieve existing revision numbers to sort them as integers
sql = "SELECT revision FROM #{Changeset.table_name} "
sql << "WHERE repository_id = #{id} AND revision NOT LIKE 'tmp%'"
@current_revision_number ||= (connection.select_values(sql).collect(&:to_i).max || 0)
@current_revision_number += 1
end
end

@ -126,10 +126,8 @@ default:
# Examples:
# scm_subversion_command: svn # (default: svn)
# scm_git_command: /usr/local/bin/git # (default: git)
# scm_cvs_command: cvs # (default: cvs)
# scm_subversion_command:
# scm_git_command:
# scm_cvs_command:
# Key used to encrypt sensitive data in the database (SCM and LDAP passwords).
# If you don't want to enable data encryption, just leave it blank.

@ -948,9 +948,7 @@ bg:
enumeration_system_activity: Системна активност
text_powered_by: Този сайт е задвижван от %{link}
label_cvs_module: Модул
label_filesystem_path: Коренна директория
label_cvs_path: CVSROOT
label_git_path: Път до директория .git
label_additional_workflow_transitions_for_assignee: Позволени са допълнителни преходи, когато потребителят е назначеният към задачата
button_expand_all: Разгъване всички

@ -956,9 +956,7 @@ bs:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -946,9 +946,7 @@ ca:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -1167,9 +1167,7 @@ cs:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -959,9 +959,7 @@ da:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -1024,9 +1024,7 @@ de:
notice_gantt_chart_truncated: Die Grafik ist unvollständig, da das Maximum der anzeigbaren Aufgaben überschritten wurde (%{max})
setting_gantt_items_limit: Maximale Anzahl von Aufgaben die im Gantt-Chart angezeigt werden.
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: "Meine Berichte"
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -943,9 +943,7 @@ el:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -962,9 +962,7 @@ en-GB:
enumeration_system_activity: System Activity
text_powered_by: "Powered by %{link}"
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee
label_additional_workflow_transitions_for_author: Additional transitions allowed when the user is the author

@ -858,8 +858,6 @@ en:
label_principal_search: "Search for user or group:"
label_user_search: "Search for user:"
label_git_path: Path to .git directory
label_cvs_path: CVSROOT
label_cvs_module: Module
label_filesystem_path: Root directory
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee
label_additional_workflow_transitions_for_author: Additional transitions allowed when the user is the author

@ -980,9 +980,7 @@ es:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -926,9 +926,7 @@ eu:
field_time_entries: "Denbora erregistratu"
project_module_gantt: Gantt
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
project_module_calendar: Egutegia
button_edit_associated_wikipage: "Esleitutako wiki orria editatu: %{page_title}"

@ -947,7 +947,6 @@ fa:
text_tip_issue_end_day: issue ending this day
text_warn_on_leaving_unsaved: The current page contains unsaved text that will be lost if you leave this page.
label_my_queries: My custom queries
label_cvs_module: Module
label_filesystem_path: Root directory
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee
text_journal_changed_no_detail: "%{label} updated"
@ -955,7 +954,6 @@ fa:
button_collapse_all: Collapse all
label_additional_workflow_transitions_for_author: Additional transitions allowed when the user is the author
label_news_comment_added: Comment added to a news
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
default_role_anonymous: Anonymous
text_powered_by: Powered by %{link}

@ -964,9 +964,7 @@ fi:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -973,9 +973,7 @@ fr:
field_assigned_to_role: Rôle de l'assigné
setting_emails_header: En-tête des emails
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
field_effective_date: Due date
text_default_encoding: "Default: UTF-8"

@ -953,9 +953,7 @@ gl:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -948,9 +948,7 @@ he:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -950,9 +950,7 @@ hr:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -963,9 +963,7 @@
notice_gantt_chart_truncated: A diagram le lett vágva, mert elérte a maximálisan megjeleníthető elemek számát (%{max})
setting_gantt_items_limit: A gantt diagrammon megjeleníthető maximális elemek száma
text_powered_by: Powered by %{link}
label_cvs_module: Modul
label_filesystem_path: Gyökér könyvtár
label_cvs_path: CVSROOT
label_git_path: A .git könyvtár elérési útja
label_my_queries: Egyéni lekérdezéseim
label_additional_workflow_transitions_for_assignee: További átmenetek engedélyezettek, ha a felhasználó a hozzárendelt

@ -951,9 +951,7 @@ id:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -944,9 +944,7 @@ it:
notice_gantt_chart_truncated: Il grafico è stato troncato perchè eccede il numero di oggetti (%{max}) da visualizzare
setting_gantt_items_limit: Massimo numero di oggetti da visualizzare sul diagramma di gantt
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -971,9 +971,7 @@ ja:
enumeration_activities: 作業分類 (時間トラッキング)
enumeration_system_activity: システム作業分類
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -995,9 +995,7 @@ ko:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -1003,9 +1003,7 @@ lt:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -938,9 +938,7 @@ lv:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -943,9 +943,7 @@ mk:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -944,9 +944,7 @@ mn:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -930,11 +930,9 @@ nl:
button_collapse_all: Klap in
label_additional_workflow_transitions_for_assignee: Aanvullende veranderingen toegestaan wanneer de gebruiker de toegewezene is
label_additional_workflow_transitions_for_author: Aanvullende veranderingen toegestaan wanneer de gebruiker de auteur is
label_cvs_module: Module
label_filesystem_path: Root directory
text_journal_changed_no_detail: "%{label} updated"
field_effective_date: Einddatum
label_cvs_path: CVSROOT
label_git_path: Pad naar .git directory
text_powered_by: Powered by %{link}
text_default_encoding: "Standaard: UTF-8"

@ -930,9 +930,7 @@
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -958,9 +958,7 @@ pl:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -976,13 +976,11 @@ pt-BR:
label_additional_workflow_transitions_for_assignee: Transições adicionais permitidas quando o usuário é o responsável pela tarefa
label_additional_workflow_transitions_for_author: Transições adicionais permitidas quando o usuário é o autor
field_effective_date: Data prevista
label_cvs_path: CVSROOT
text_powered_by: Tecnologia empregada por %{link}
text_default_encoding: "Padrão: UTF-8"
text_git_repo_example: "um repositório local do tipo bare (ex.: /gitrepo, c:\\gitrepo)"
label_notify_member_plural: Enviar atualizações da tarefa por e-mail
label_path_encoding: Codificação do caminho
label_cvs_module: Módulo
label_filesystem_path: Diretório raiz
label_git_path: Caminho para o diretório .git

@ -947,9 +947,7 @@ pt:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -936,9 +936,7 @@ ro:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -1056,9 +1056,7 @@ ru:
notice_gantt_chart_truncated: Диаграмма будет усечена, поскольку превышено максимальное кол-во элементов, которые могут отображаться (%{max})
setting_gantt_items_limit: Максимальное кол-во элементов отображаемых на диаграмме Ганта
text_powered_by: Powered by %{link}
label_cvs_module: Модуль
label_filesystem_path: Каталог
label_cvs_path: CVSROOT
label_git_path: Путь к каталогу .git
label_my_queries: Мои сохраненные запросы
label_additional_workflow_transitions_for_assignee: Дополнительные переходы, когда пользователь является исполнителем

@ -938,9 +938,7 @@ sk:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -939,9 +939,7 @@ sl:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -943,9 +943,7 @@ sr-YU:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -944,9 +944,7 @@ sr:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -988,9 +988,7 @@ sv:
enumeration_activities: Aktiviteter (tidsuppföljning)
enumeration_system_activity: Systemaktivitet
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -940,9 +940,7 @@ th:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -962,9 +962,7 @@ tr:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -939,9 +939,7 @@ uk:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -994,9 +994,7 @@ vi:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -1028,9 +1028,7 @@
enumeration_activities: 活動 (時間追蹤)
enumeration_system_activity: 系統活動
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -957,9 +957,7 @@ zh:
notice_gantt_chart_truncated: The chart was truncated because it exceeds the maximum number of items that can be displayed (%{max})
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
text_powered_by: Powered by %{link}
label_cvs_module: Module
label_filesystem_path: Root directory
label_cvs_path: CVSROOT
label_git_path: Path to .git directory
label_my_queries: My custom queries
label_additional_workflow_transitions_for_assignee: Additional transitions allowed when the user is the assignee

@ -67,7 +67,6 @@ enabled_scm:
serialized: true
default:
- Subversion
- Cvs
- Git
autofetch_changesets:
default: 1

@ -42,7 +42,6 @@ end
require 'globalize'
Redmine::Scm::Base.add "Subversion"
Redmine::Scm::Base.add "Cvs"
Redmine::Scm::Base.add "Git"
Redmine::Scm::Base.add "Filesystem"

@ -1,436 +0,0 @@
#-- encoding: UTF-8
#-- copyright
# ChiliProject is a project management system.
#
# Copyright (C) 2010-2011 the ChiliProject Team
#
# 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.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
require 'redmine/scm/adapters/abstract_adapter'
module Redmine
module Scm
module Adapters
class CvsAdapter < AbstractAdapter
# CVS executable name
CVS_BIN = Redmine::Configuration['scm_cvs_command'] || "cvs"
# raised if scm command exited with error, e.g. unknown revision.
class ScmCommandAborted < CommandFailed; end
class << self
def client_command
@@bin ||= CVS_BIN
end
def sq_bin
@@sq_bin ||= shell_quote(CVS_BIN)
end
def client_version
@@client_version ||= (scm_command_version || [])
end
def client_available
client_version_above?([1, 12])
end
def scm_command_version
scm_version = scm_version_from_command_line.dup
if scm_version.respond_to?(:force_encoding)
scm_version.force_encoding('ASCII-8BIT')
end
if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)}m)
m[2].scan(%r{\d+}).collect(&:to_i)
end
end
def scm_version_from_command_line
shellout("#{sq_bin} --version") { |io| io.read }.to_s
end
end
# Guidelines for the input:
# url -> the project-path, relative to the cvsroot (eg. module name)
# root_url -> the good old, sometimes damned, CVSROOT
# login -> unnecessary
# password -> unnecessary too
def initialize(url, root_url=nil, login=nil, password=nil,
path_encoding=nil)
@url = url
@login = login if login && !login.empty?
@password = (password || "") if @login
#TODO: better Exception here (IllegalArgumentException)
raise CommandFailed if root_url.blank?
@root_url = root_url
end
def root_url
@root_url
end
def url
@url
end
def info
logger.debug "<cvs> info"
Info.new({:root_url => @root_url, :lastrev => nil})
end
def get_previous_revision(revision)
CvsRevisionHelper.new(revision).prevRev
end
# Returns an Entries collection
# or nil if the given path doesn't exist in the repository
# this method is used by the repository-browser (aka LIST)
def entries(path=nil, identifier=nil)
logger.debug "<cvs> entries '#{path}' with identifier '#{identifier}'"
path_with_project="#{url}#{with_leading_slash(path)}"
entries = Entries.new
cmd_args = %w|rls -e|
cmd_args << "-D" << time_to_cvstime_rlog(identifier) if identifier
cmd_args << path_with_project
scm_cmd(*cmd_args) do |io|
io.each_line() do |line|
fields = line.chop.split('/',-1)
logger.debug(">>InspectLine #{fields.inspect}")
if fields[0]!="D"
time = nil
# Thu Dec 13 16:27:22 2007
time_l = fields[-3].split(' ')
if time_l.size == 5 && time_l[4].length == 4
begin
time = Time.parse(
"#{time_l[1]} #{time_l[2]} #{time_l[3]} GMT #{time_l[4]}")
rescue
end
end
entries << Entry.new(
{
:name => fields[-5],
#:path => fields[-4].include?(path)?fields[-4]:(path + "/"+ fields[-4]),
:path => "#{path}/#{fields[-5]}",
:kind => 'file',
:size => nil,
:lastrev => Revision.new(
{
:revision => fields[-4],
:name => fields[-4],
:time => time,
:author => ''
})
})
else
entries << Entry.new(
{
:name => fields[1],
:path => "#{path}/#{fields[1]}",
:kind => 'dir',
:size => nil,
:lastrev => nil
})
end
end
end
entries.sort_by_name
rescue ScmCommandAborted
nil
end
STARTLOG="----------------------------"
ENDLOG ="============================================================================="
# Returns all revisions found between identifier_from and identifier_to
# in the repository. both identifier have to be dates or nil.
# these method returns nothing but yield every result in block
def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={}, &block)
logger.debug "<cvs> revisions path:'#{path}',identifier_from #{identifier_from}, identifier_to #{identifier_to}"
path_with_project="#{url}#{with_leading_slash(path)}"
cmd_args = %w|rlog|
cmd_args << "-d" << ">#{time_to_cvstime_rlog(identifier_from)}" if identifier_from
cmd_args << path_with_project
scm_cmd(*cmd_args) do |io|
state="entry_start"
commit_log=String.new
revision=nil
date=nil
author=nil
entry_path=nil
entry_name=nil
file_state=nil
branch_map=nil
io.each_line() do |line|
if state!="revision" && /^#{ENDLOG}/ =~ line
commit_log=String.new
revision=nil
state="entry_start"
end
if state=="entry_start"
branch_map=Hash.new
if /^RCS file: #{Regexp.escape(root_url_path)}\/#{Regexp.escape(path_with_project)}(.+),v$/ =~ line
entry_path = normalize_cvs_path($1)
entry_name = normalize_path(File.basename($1))
logger.debug("Path #{entry_path} <=> Name #{entry_name}")
elsif /^head: (.+)$/ =~ line
entry_headRev = $1 #unless entry.nil?
elsif /^symbolic names:/ =~ line
state="symbolic" #unless entry.nil?
elsif /^#{STARTLOG}/ =~ line
commit_log=String.new
state="revision"
end
next
elsif state=="symbolic"
if /^(.*):\s(.*)/ =~ (line.strip)
branch_map[$1]=$2
else
state="tags"
next
end
elsif state=="tags"
if /^#{STARTLOG}/ =~ line
commit_log = ""
state="revision"
elsif /^#{ENDLOG}/ =~ line
state="head"
end
next
elsif state=="revision"
if /^#{ENDLOG}/ =~ line || /^#{STARTLOG}/ =~ line
if revision
revHelper=CvsRevisionHelper.new(revision)
revBranch="HEAD"
branch_map.each() do |branch_name,branch_point|
if revHelper.is_in_branch_with_symbol(branch_point)
revBranch=branch_name
end
end
logger.debug("********** YIELD Revision #{revision}::#{revBranch}")
yield Revision.new({
:time => date,
:author => author,
:message=>commit_log.chomp,
:paths => [{
:revision => revision,
:branch=> revBranch,
:path=>entry_path,
:name=>entry_name,
:kind=>'file',
:action=>file_state
}]
})
end
commit_log=String.new
revision=nil
if /^#{ENDLOG}/ =~ line
state="entry_start"
end
next
end
if /^branches: (.+)$/ =~ line
#TODO: version.branch = $1
elsif /^revision (\d+(?:\.\d+)+).*$/ =~ line
revision = $1
elsif /^date:\s+(\d+.\d+.\d+\s+\d+:\d+:\d+)/ =~ line
date = Time.parse($1)
author = /author: ([^;]+)/.match(line)[1]
file_state = /state: ([^;]+)/.match(line)[1]
#TODO: linechanges only available in CVS.... maybe a feature our SVN implementation. i'm sure, they are
# useful for stats or something else
# linechanges =/lines: \+(\d+) -(\d+)/.match(line)
# unless linechanges.nil?
# version.line_plus = linechanges[1]
# version.line_minus = linechanges[2]
# else
# version.line_plus = 0
# version.line_minus = 0
# end
else
commit_log << line unless line =~ /^\*\*\* empty log message \*\*\*/
end
end
end
end
rescue ScmCommandAborted
Revisions.new
end
def diff(path, identifier_from, identifier_to=nil)
logger.debug "<cvs> diff path:'#{path}',identifier_from #{identifier_from}, identifier_to #{identifier_to}"
path_with_project="#{url}#{with_leading_slash(path)}"
cmd = "#{self.class.sq_bin} -d #{shell_quote root_url} rdiff -u -r#{identifier_to} -r#{identifier_from} #{shell_quote path_with_project}"
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)
identifier = (identifier) ? identifier : "HEAD"
logger.debug "<cvs> cat path:'#{path}',identifier #{identifier}"
path_with_project="#{url}#{with_leading_slash(path)}"
cmd = "#{self.class.sq_bin} -d #{shell_quote root_url} co"
cmd << " -D \"#{time_to_cvstime(identifier)}\"" if identifier
cmd << " -p #{shell_quote path_with_project}"
cat = nil
shellout(cmd) do |io|
io.binmode
cat = io.read
end
return nil if $? && $?.exitstatus != 0
cat
end
def annotate(path, identifier=nil)
identifier = (identifier) ? identifier.to_i : "HEAD"
logger.debug "<cvs> annotate path:'#{path}',identifier #{identifier}"
path_with_project="#{url}#{with_leading_slash(path)}"
cmd = "#{self.class.sq_bin} -d #{shell_quote root_url} rannotate -r#{identifier} #{shell_quote path_with_project}"
blame = Annotate.new
shellout(cmd) do |io|
io.each_line do |line|
next unless line =~ %r{^([\d\.]+)\s+\(([^\)]+)\s+[^\)]+\):\s(.*)$}
blame.add_line($3.rstrip, Revision.new(:revision => $1, :author => $2.strip))
end
end
return nil if $? && $?.exitstatus != 0
blame
end
private
# Returns the root url without the connexion string
# :pserver:anonymous@foo.bar:/path => /path
# :ext:cvsservername:/path => /path
def root_url_path
root_url.to_s.gsub(/^:.+:\d*/, '')
end
# convert a date/time into the CVS-format
def time_to_cvstime(time)
return nil if time.nil?
return Time.now if time == 'HEAD'
unless time.kind_of? Time
time = Time.parse(time)
end
return time.strftime("%Y-%m-%d %H:%M:%S")
end
def time_to_cvstime_rlog(time)
return nil if time.nil?
t1 = time.clone.localtime
return t1.strftime("%Y-%m-%d %H:%M:%S")
end
def normalize_cvs_path(path)
normalize_path(path.gsub(/Attic\//,''))
end
def normalize_path(path)
path.sub(/^(\/)*(.*)/,'\2').sub(/(.*)(,v)+/,'\1')
end
def scm_cmd(*args, &block)
full_args = [CVS_BIN, '-d', root_url]
full_args += args
ret = shellout(full_args.map { |e| shell_quote e.to_s }.join(' '), &block)
if $? && $?.exitstatus != 0
raise ScmCommandAborted, "cvs exited with non-zero status: #{$?.exitstatus}"
end
ret
end
private :scm_cmd
end
class CvsRevisionHelper
attr_accessor :complete_rev, :revision, :base, :branchid
def initialize(complete_rev)
@complete_rev = complete_rev
parseRevision()
end
def branchPoint
return @base
end
def branchVersion
if isBranchRevision
return @base+"."+@branchid
end
return @base
end
def isBranchRevision
!@branchid.nil?
end
def prevRev
unless @revision==0
return buildRevision(@revision-1)
end
return buildRevision(@revision)
end
def is_in_branch_with_symbol(branch_symbol)
bpieces=branch_symbol.split(".")
branch_start="#{bpieces[0..-3].join(".")}.#{bpieces[-1]}"
return (branchVersion==branch_start)
end
private
def buildRevision(rev)
if rev== 0
if @branchid.nil?
@base+".0"
else
@base
end
elsif @branchid.nil?
@base+"."+rev.to_s
else
@base+"."+@branchid+"."+rev.to_s
end
end
# Interpretiert die cvs revisionsnummern wie z.b. 1.14 oder 1.3.0.15
def parseRevision()
pieces=@complete_rev.split(".")
@revision=pieces.last.to_i
baseSize=1
baseSize+=(pieces.size/2)
@base=pieces[0..-baseSize].join(".")
if baseSize > 2
@branchid=pieces[-2]
end
end
end
end
end
end

@ -45,7 +45,7 @@ namespace :test do
FileUtils.mkdir_p Rails.root + '/tmp/test'
end
supported_scms = [:subversion, :cvs, :git, :filesystem]
supported_scms = [:subversion, :git, :filesystem]
desc "Creates a test subversion repository"
task :subversion => :create_dir do

@ -1,202 +0,0 @@
#-- encoding: UTF-8
#-- copyright
# ChiliProject is a project management system.
#
# Copyright (C) 2010-2011 the ChiliProject Team
#
# 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.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
require File.expand_path('../../test_helper', __FILE__)
require 'repositories_controller'
# Re-raise errors caught by the controller.
class RepositoriesController; def rescue_action(e) raise e end; end
class RepositoriesCvsControllerTest < ActionController::TestCase
fixtures :projects, :users, :roles, :members, :member_roles, :repositories, :enabled_modules
# No '..' in the repository path
REPOSITORY_PATH = Rails.root.to_s.gsub(%r{config\/\.\.}, '') + '/tmp/test/cvs_repository'
REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
# CVS module
MODULE_NAME = 'test'
PRJ_ID = 3
def setup
@controller = RepositoriesController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
Setting.default_language = 'en'
User.current = nil
@project = Project.find(PRJ_ID)
@repository = Repository::Cvs.create(:project => Project.find(PRJ_ID),
:root_url => REPOSITORY_PATH,
:url => MODULE_NAME,
:log_encoding => 'UTF-8')
# see repositories_subversion_controller_test.rb
def @repository.reload
ActiveRecord::Base.connection.clear_query_cache
self.class.find(self.id)
end
assert @repository
end
if File.directory?(REPOSITORY_PATH)
def test_browse_root
@repository.fetch_changesets
@repository.reload
get :show, :id => PRJ_ID
assert_response :success
assert_template 'show'
assert_not_nil assigns(:entries)
assert_equal 3, assigns(:entries).size
entry = assigns(:entries).detect {|e| e.name == 'images'}
assert_equal 'dir', entry.kind
entry = assigns(:entries).detect {|e| e.name == 'README'}
assert_equal 'file', entry.kind
assert_not_nil assigns(:changesets)
assigns(:changesets).size > 0
end
def test_browse_directory
@repository.fetch_changesets
@repository.reload
get :show, :id => PRJ_ID, :path => ['images']
assert_response :success
assert_template 'show'
assert_not_nil assigns(:entries)
assert_equal ['plus.png', 'delete.png', 'edit.png'], assigns(:entries).collect(&:name)
entry = assigns(:entries).detect {|e| e.name == 'edit.png'}
assert_not_nil entry
assert_equal 'file', entry.kind
assert_equal 'images/edit.png', entry.path
end
def test_browse_at_given_revision
@repository.fetch_changesets
@repository.reload
get :show, :id => PRJ_ID, :path => ['images'], :rev => 1
assert_response :success
assert_template 'show'
assert_not_nil assigns(:entries)
assert_equal ['delete.png', 'edit.png'], assigns(:entries).collect(&:name)
end
def test_entry
@repository.fetch_changesets
@repository.reload
get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
assert_response :success
assert_template 'entry'
assert_no_tag :tag => 'td', :attributes => { :class => /line-code/},
:content => /before_filter/
end
def test_entry_at_given_revision
# changesets must be loaded
@repository.fetch_changesets
@repository.reload
get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'], :rev => 2
assert_response :success
assert_template 'entry'
# this line was removed in r3
assert_tag :tag => 'td', :attributes => { :class => /line-code/},
:content => /before_filter/
end
def test_entry_not_found
@repository.fetch_changesets
@repository.reload
get :entry, :id => PRJ_ID, :path => ['sources', 'zzz.c']
assert_tag :tag => 'p', :attributes => { :id => /errorExplanation/ },
:content => /The entry or revision was not found in the repository/
end
def test_entry_download
@repository.fetch_changesets
@repository.reload
get :entry, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb'], :format => 'raw'
assert_response :success
end
def test_directory_entry
@repository.fetch_changesets
@repository.reload
get :entry, :id => PRJ_ID, :path => ['sources']
assert_response :success
assert_template 'show'
assert_not_nil assigns(:entry)
assert_equal 'sources', assigns(:entry).name
end
def test_diff
@repository.fetch_changesets
@repository.reload
get :diff, :id => PRJ_ID, :rev => 3, :type => 'inline'
assert_response :success
assert_template 'diff'
assert_tag :tag => 'td', :attributes => { :class => 'line-code diff_out' },
:content => /before_filter :require_login/
assert_tag :tag => 'td', :attributes => { :class => 'line-code diff_in' },
:content => /with one change/
end
def test_diff_new_files
@repository.fetch_changesets
@repository.reload
get :diff, :id => PRJ_ID, :rev => 1, :type => 'inline'
assert_response :success
assert_template 'diff'
assert_tag :tag => 'td', :attributes => { :class => 'line-code diff_in' },
:content => /watched.remove_watcher/
assert_tag :tag => 'th', :attributes => { :class => 'filename' },
:content => /test\/README/
assert_tag :tag => 'th', :attributes => { :class => 'filename' },
:content => /test\/images\/delete.png /
assert_tag :tag => 'th', :attributes => { :class => 'filename' },
:content => /test\/images\/edit.png/
assert_tag :tag => 'th', :attributes => { :class => 'filename' },
:content => /test\/sources\/watchers_controller.rb/
end
def test_annotate
@repository.fetch_changesets
@repository.reload
get :annotate, :id => PRJ_ID, :path => ['sources', 'watchers_controller.rb']
assert_response :success
assert_template 'annotate'
# 1.1 line
assert_tag :tag => 'th', :attributes => { :class => 'line-num' },
:content => '18',
:sibling => { :tag => 'td', :attributes => { :class => 'revision' },
:content => /1.1/,
:sibling => { :tag => 'td', :attributes => { :class => 'author' },
:content => /LANG/
}
}
# 1.2 line
assert_tag :tag => 'th', :attributes => { :class => 'line-num' },
:content => '32',
:sibling => { :tag => 'td', :attributes => { :class => 'revision' },
:content => /1.2/,
:sibling => { :tag => 'td', :attributes => { :class => 'author' },
:content => /LANG/
}
}
end
else
puts "CVS test repository NOT FOUND. Skipping functional tests !!!"
def test_fake; assert true end
end
end

@ -1,81 +0,0 @@
#-- encoding: UTF-8
#-- copyright
# ChiliProject is a project management system.
#
# Copyright (C) 2010-2011 the ChiliProject Team
#
# 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.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
require File.expand_path('../../../../../../test_helper', __FILE__)
begin
require 'mocha/setup'
class CvsAdapterTest < ActiveSupport::TestCase
REPOSITORY_PATH = Rails.root.to_s.gsub(%r{config\/\.\.}, '') + '/tmp/test/cvs_repository'
REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
MODULE_NAME = 'test'
if File.directory?(REPOSITORY_PATH)
def setup
@adapter = Redmine::Scm::Adapters::CvsAdapter.new(MODULE_NAME, REPOSITORY_PATH)
end
def test_scm_version
to_test = { "\nConcurrent Versions System (CVS) 1.12.13 (client/server)\n" => [1,12,13],
"\r\n1.12.12\r\n1.12.11" => [1,12,12],
"1.12.11\r\n1.12.10\r\n" => [1,12,11]}
to_test.each do |s, v|
test_scm_version_for(s, v)
end
end
def test_revisions_all
cnt = 0
@adapter.revisions('', nil, nil, :with_paths => true) do |revision|
cnt += 1
end
assert_equal 14, cnt
end
def test_revisions_from_rev3
rev3_committed_on = Time.gm(2007, 12, 13, 16, 27, 22)
cnt = 0
@adapter.revisions('', rev3_committed_on, nil, :with_paths => true) do |revision|
cnt += 1
end
assert_equal 2, cnt
end
def test_entries_rev3
rev3_committed_on = Time.gm(2007, 12, 13, 16, 27, 22)
entries = @adapter.entries('sources', rev3_committed_on)
assert_equal 2, entries.size
assert_equal entries[0].name, "watchers_controller.rb"
assert_equal entries[0].lastrev.time, Time.gm(2007, 12, 13, 16, 27, 22)
end
private
def test_scm_version_for(scm_command_version, version)
@adapter.class.expects(:scm_version_from_command_line).returns(scm_command_version)
assert_equal version, @adapter.class.scm_command_version
end
else
puts "Cvs test repository NOT FOUND. Skipping unit tests !!!"
def test_fake; assert true end
end
end
rescue LoadError
class CvsMochaFake < ActiveSupport::TestCase
def test_fake; assert(false, "Requires mocha to run those tests") end
end
end

@ -1,104 +0,0 @@
#-- encoding: UTF-8
#-- copyright
# ChiliProject is a project management system.
#
# Copyright (C) 2010-2011 the ChiliProject Team
#
# 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.
#
# See doc/COPYRIGHT.rdoc for more details.
#++
require File.expand_path('../../test_helper', __FILE__)
require 'pp'
class RepositoryCvsTest < ActiveSupport::TestCase
fixtures :projects
# No '..' in the repository path
REPOSITORY_PATH = Rails.root.to_s.gsub(%r{config\/\.\.}, '') + '/tmp/test/cvs_repository'
REPOSITORY_PATH.gsub!(/\//, "\\") if Redmine::Platform.mswin?
# CVS module
MODULE_NAME = 'test'
def setup
@project = Project.find(3)
@repository = Repository::Cvs.create(:project => @project,
:root_url => REPOSITORY_PATH,
:url => MODULE_NAME,
:log_encoding => 'UTF-8')
assert @repository
end
if File.directory?(REPOSITORY_PATH)
def test_fetch_changesets_from_scratch
assert_equal 0, @repository.changesets.count
@repository.fetch_changesets
@repository.reload
assert_equal 5, @repository.changesets.count
assert_equal 14, @repository.changes.count
assert_not_nil @repository.changesets.find_by_comments('Two files changed')
r2 = @repository.changesets.find_by_revision('2')
assert_equal 'v1-20071213-162510', r2.scmid
end
def test_fetch_changesets_incremental
assert_equal 0, @repository.changesets.count
@repository.fetch_changesets
# Remove changesets with revision > 3
@repository.changesets.find(:all).each {|c| c.destroy if c.revision.to_i > 3}
@repository.reload
assert_equal 3, @repository.changesets.count
assert_equal %w|3 2 1|, @repository.changesets.collect(&:revision)
rev3_commit = @repository.changesets.reorder('committed_on DESC').first
assert_equal '3', rev3_commit.revision
# 2007-12-14 01:27:22 +0900
rev3_committed_on = Time.gm(2007, 12, 13, 16, 27, 22)
assert_equal 'HEAD-20071213-162722', rev3_commit.scmid
assert_equal rev3_committed_on, rev3_commit.committed_on
latest_rev = @repository.latest_changeset
assert_equal rev3_committed_on, latest_rev.committed_on
@repository.fetch_changesets
@repository.reload
assert_equal 5, @repository.changesets.count
assert_equal %w|5 4 3 2 1|, @repository.changesets.collect(&:revision)
rev5_commit = @repository.changesets.find(:first, :order => 'committed_on DESC')
assert_equal 'HEAD-20071213-163001', rev5_commit.scmid
# 2007-12-14 01:30:01 +0900
rev5_committed_on = Time.gm(2007, 12, 13, 16, 30, 1)
assert_equal rev5_committed_on, rev5_commit.committed_on
end
def test_deleted_files_should_not_be_listed
assert_equal 0, @repository.changesets.count
@repository.fetch_changesets
@repository.reload
assert_equal 5, @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_entries_rev3
@repository.fetch_changesets
@repository.reload
entries = @repository.entries('', '3')
assert_equal 3, entries.size
assert_equal entries[2].name, "README"
assert_equal entries[2].lastrev.time, Time.gm(2007, 12, 13, 16, 27, 22)
assert_equal entries[2].lastrev.identifier, '3'
assert_equal entries[2].lastrev.revision, '3'
assert_equal entries[2].lastrev.author, 'LANG'
end
else
puts "CVS test repository NOT FOUND. Skipping unit tests !!!"
def test_fake; assert true end
end
end

@ -119,14 +119,14 @@ class RepositoryTest < ActiveSupport::TestCase
end
def test_for_urls_strip
repository = Repository::Cvs.create(
repository = Repository::Subversion.create(
:project => Project.find(4),
:url => ' :pserver:login:password@host:/path/to/the/repository',
:root_url => 'foo ',
:url => ' svn://:login:password@host:/path/to/the/repository',
:log_encoding => 'UTF-8')
repository.root_url = 'foo ' # can't mass-assign this attr
assert repository.save
repository.reload
assert_equal ':pserver:login:password@host:/path/to/the/repository', repository.url
assert_equal 'svn://:login:password@host:/path/to/the/repository', repository.url
assert_equal 'foo', repository.root_url
end

Loading…
Cancel
Save