Redmine 4.1.1

This commit is contained in:
Manuel Cillero 2020-11-22 21:20:06 +01:00
parent 33e7b881a5
commit 3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions

View file

@ -1,5 +1,7 @@
# frozen_string_literal: true
# redMine - project management software
# Copyright (C) 2006-2007 Jean-Philippe Lang
# Copyright (C) 2006-2019 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -43,7 +45,7 @@ module Redmine
end
def scm_command_version
scm_version = scm_version_from_command_line.dup.force_encoding('ASCII-8BIT')
scm_version = scm_version_from_command_line.b
if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)}m)
m[2].scan(%r{\d+}).collect(&:to_i)
end
@ -61,7 +63,7 @@ module Redmine
# password -> unnecessary too
def initialize(url, root_url=nil, login=nil, password=nil,
path_encoding=nil)
@path_encoding = path_encoding.blank? ? 'UTF-8' : path_encoding
@path_encoding = path_encoding.presence || 'UTF-8'
@url = url
# TODO: better Exception here (IllegalArgumentException)
raise CommandFailed if root_url.blank?
@ -91,7 +93,7 @@ module Redmine
def entries(path=nil, identifier=nil, options={})
logger.debug "<cvs> entries '#{path}' with identifier '#{identifier}'"
path_locale = scm_iconv(@path_encoding, 'UTF-8', path)
path_locale.force_encoding("ASCII-8BIT")
path_locale = path_locale.b
entries = Entries.new
cmd_args = %w|-q rls -e|
cmd_args << "-D" << time_to_cvstime_rlog(identifier) if identifier
@ -159,7 +161,7 @@ module Redmine
cmd_args << path_with_project_utf8
scm_cmd(*cmd_args) do |io|
state = "entry_start"
commit_log = String.new
commit_log = ""
revision = nil
date = nil
author = nil
@ -168,23 +170,23 @@ module Redmine
file_state = nil
branch_map = nil
io.each_line() do |line|
if state != "revision" && /^#{ENDLOG}/ =~ line
commit_log = String.new
if state != "revision" && /^#{ENDLOG}/.match?(line)
commit_log = ""
revision = nil
state = "entry_start"
end
if state == "entry_start"
branch_map = Hash.new
branch_map = {}
if /^RCS file: #{Regexp.escape(root_url_path)}\/#{Regexp.escape(path_with_project_locale)}(.+),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
entry_headRev = $1
elsif /^symbolic names:/.match?(line)
state = "symbolic"
elsif /^#{STARTLOG}/.match?(line)
commit_log = ""
state = "revision"
end
next
@ -228,7 +230,7 @@ module Redmine
}]
})
end
commit_log = String.new
commit_log = ""
revision = nil
if /^#{ENDLOG}/ =~ line
state = "entry_start"
@ -241,15 +243,14 @@ module Redmine
elsif /^revision (\d+(?:\.\d+)+).*$/ =~ line
revision = $1
elsif /^date:\s+(\d+.\d+.\d+\s+\d+:\d+:\d+)/ =~ line
date = Time.parse($1)
date = Time.parse($1)
line_utf8 = scm_iconv('UTF-8', options[:log_encoding], line)
author_utf8 = /author: ([^;]+)/.match(line_utf8)[1]
author = scm_iconv(options[:log_encoding], 'UTF-8', author_utf8)
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
# 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]
@ -259,7 +260,7 @@ module Redmine
# version.line_minus = 0
# end
else
commit_log << line unless line =~ /^\*\*\* empty log message \*\*\*/
commit_log += line unless line =~ /^\*\*\* empty log message \*\*\*/
end
end
end
@ -338,9 +339,8 @@ module Redmine
# convert a date/time into the CVS-format
def time_to_cvstime(time)
return nil if time.nil?
time = Time.now if (time.kind_of?(String) && time == 'HEAD')
unless time.kind_of? Time
time = Time.now if (time.is_a?(String) && time == 'HEAD')
unless time.is_a?(Time)
time = Time.parse(time)
end
return time_to_cvstime_rlog(time)
@ -399,10 +399,6 @@ module Redmine
parseRevision()
end
def branchPoint
return @base
end
def branchVersion
if isBranchRevision
return @base+"."+@branchid
@ -428,6 +424,7 @@ module Redmine
end
private
def buildRevision(rev)
if rev == 0
if @branchid.nil?
@ -443,7 +440,7 @@ module Redmine
end
# Interpretiert die cvs revisionsnummern wie z.b. 1.14 oder 1.3.0.15
def parseRevision()
def parseRevision
pieces = @complete_rev.split(".")
@revision = pieces.last.to_i
baseSize = 1