diff --git a/.travis.yml b/.travis.yml index 4819fd75f6..90f432fc5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index b7318ce834..093a626385 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -217,13 +217,6 @@ module RepositoriesHelper '
' + 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, diff --git a/app/models/repository/cvs.rb b/app/models/repository/cvs.rb deleted file mode 100644 index 1c7b792d45..0000000000 --- a/app/models/repository/cvs.rb +++ /dev/null @@ -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 diff --git a/config/configuration.yml.example b/config/configuration.yml.example index 8316463de3..b249835a3e 100644 --- a/config/configuration.yml.example +++ b/config/configuration.yml.example @@ -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. diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 42e26ddf06..62c8a7d8b7 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -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: Разгъване всички diff --git a/config/locales/bs.yml b/config/locales/bs.yml index 4fbcaf1f26..5c0dbbcbb0 100644 --- a/config/locales/bs.yml +++ b/config/locales/bs.yml @@ -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 diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 7ce64fc2dd..0873d9f18b 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -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 diff --git a/config/locales/cs.yml b/config/locales/cs.yml index 5f6ff9a7f0..c222c62e7a 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -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 diff --git a/config/locales/da.yml b/config/locales/da.yml index 195d129d09..6c611c5cc2 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -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 diff --git a/config/locales/de.yml b/config/locales/de.yml index a4f49dc7f7..b93a8c3139 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -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 diff --git a/config/locales/el.yml b/config/locales/el.yml index 1121d5981b..0084061298 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -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 diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml index acfff264ef..641db4e660 100644 --- a/config/locales/en-GB.yml +++ b/config/locales/en-GB.yml @@ -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 diff --git a/config/locales/en.yml b/config/locales/en.yml index c4e882a66f..2f72871bda 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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 diff --git a/config/locales/es.yml b/config/locales/es.yml index eb8a3352ae..5784643d55 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -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 diff --git a/config/locales/eu.yml b/config/locales/eu.yml index 2e12643f27..7779a60396 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -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}" diff --git a/config/locales/fa.yml b/config/locales/fa.yml index e416ec3bc6..3f44704844 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -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} diff --git a/config/locales/fi.yml b/config/locales/fi.yml index fe47b72b5a..d8a21eb4c1 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -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 diff --git a/config/locales/fr.yml b/config/locales/fr.yml index ef50761f06..ebdbc81fa6 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -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" diff --git a/config/locales/gl.yml b/config/locales/gl.yml index ad67b9842b..380c0dc61d 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -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 diff --git a/config/locales/he.yml b/config/locales/he.yml index 509132af39..ff5d82fc3e 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -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 diff --git a/config/locales/hr.yml b/config/locales/hr.yml index 95d5a37b2f..4310f55961 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -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 diff --git a/config/locales/hu.yml b/config/locales/hu.yml index 62f9aad5ae..46a153f35e 100755 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -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 diff --git a/config/locales/id.yml b/config/locales/id.yml index bab92e578a..4f42b28c4e 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -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 diff --git a/config/locales/it.yml b/config/locales/it.yml index 9490618a2e..80279f73dd 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -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 diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 10d3a91d06..cc68e6898c 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -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 diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 52a0d9c202..4c7c67b8ab 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -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 diff --git a/config/locales/lt.yml b/config/locales/lt.yml index 10807467d3..be680fe486 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -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 diff --git a/config/locales/lv.yml b/config/locales/lv.yml index 2527cd18c1..0685dbf518 100644 --- a/config/locales/lv.yml +++ b/config/locales/lv.yml @@ -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 diff --git a/config/locales/mk.yml b/config/locales/mk.yml index db45c635e4..8bcf982976 100644 --- a/config/locales/mk.yml +++ b/config/locales/mk.yml @@ -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 diff --git a/config/locales/mn.yml b/config/locales/mn.yml index 3d0528849f..62753e9266 100644 --- a/config/locales/mn.yml +++ b/config/locales/mn.yml @@ -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 diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 1906de9fdb..514c978ce1 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -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" diff --git a/config/locales/no.yml b/config/locales/no.yml index ebc02562a3..f22f252c2a 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -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 diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 5220672638..f434e252cc 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -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 diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 6a08a0e485..89e244eb48 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -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 diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 81fd5375ce..714773ac73 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -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 diff --git a/config/locales/ro.yml b/config/locales/ro.yml index 61e4ab6dd5..18b19821d8 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -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 diff --git a/config/locales/ru.yml b/config/locales/ru.yml index e4f134481d..530b69c535 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -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: Дополнительные переходы, когда пользователь является исполнителем diff --git a/config/locales/sk.yml b/config/locales/sk.yml index 97162a3b1d..face5ee449 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -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 diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 1e45adf456..40241916e9 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -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 diff --git a/config/locales/sr-YU.yml b/config/locales/sr-YU.yml index f6d4494590..ad1ef22a33 100644 --- a/config/locales/sr-YU.yml +++ b/config/locales/sr-YU.yml @@ -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 diff --git a/config/locales/sr.yml b/config/locales/sr.yml index e2a1b8ad08..d3e4977bc2 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -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 diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 6d64417ae4..6494505e3a 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -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 diff --git a/config/locales/th.yml b/config/locales/th.yml index b9c14af309..02e4bfd202 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -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 diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 4ce2cbdb4c..a98178851f 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -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 diff --git a/config/locales/uk.yml b/config/locales/uk.yml index dedfc169c6..7c2e1864e4 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -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 diff --git a/config/locales/vi.yml b/config/locales/vi.yml index 6e774379d2..1affad2295 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -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 diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 2ffd2d5187..84b59f46f2 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -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 diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 452d3d6fa8..5fa1d4a71d 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -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 diff --git a/config/settings.yml b/config/settings.yml index 07a9a8e9db..65fa6b5cf0 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -67,7 +67,6 @@ enabled_scm: serialized: true default: - Subversion - - Cvs - Git autofetch_changesets: default: 1 diff --git a/lib/redmine.rb b/lib/redmine.rb index 7f80f7c86a..0b729a0055 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -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" diff --git a/lib/redmine/scm/adapters/cvs_adapter.rb b/lib/redmine/scm/adapters/cvs_adapter.rb deleted file mode 100644 index 867fc5db2d..0000000000 --- a/lib/redmine/scm/adapters/cvs_adapter.rb +++ /dev/null @@ -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 " 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 " 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 " 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 " 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 " 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 " 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 diff --git a/lib/tasks/testing.rake b/lib/tasks/testing.rake index a12d2fd6cb..2dbdebead1 100644 --- a/lib/tasks/testing.rake +++ b/lib/tasks/testing.rake @@ -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 diff --git a/test/fixtures/repositories/cvs_repository.tar.gz b/test/fixtures/repositories/cvs_repository.tar.gz deleted file mode 100644 index 638b166b5e..0000000000 Binary files a/test/fixtures/repositories/cvs_repository.tar.gz and /dev/null differ diff --git a/test/functional/repositories_cvs_controller_test.rb b/test/functional/repositories_cvs_controller_test.rb deleted file mode 100644 index 3884d875ae..0000000000 --- a/test/functional/repositories_cvs_controller_test.rb +++ /dev/null @@ -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 diff --git a/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb deleted file mode 100644 index eebdec15b2..0000000000 --- a/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb +++ /dev/null @@ -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 - diff --git a/test/unit/repository_cvs_test.rb b/test/unit/repository_cvs_test.rb deleted file mode 100644 index 813cc66c5f..0000000000 --- a/test/unit/repository_cvs_test.rb +++ /dev/null @@ -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 diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb index 1767651c42..c6b5a42eca 100644 --- a/test/unit/repository_test.rb +++ b/test/unit/repository_test.rb @@ -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