Redmine 4.1.1
This commit is contained in:
parent
33e7b881a5
commit
3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 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
|
||||
|
@ -47,7 +49,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[2].scan(%r{\d+}).collect(&:to_i)
|
||||
end
|
||||
|
@ -68,11 +70,9 @@ module Redmine
|
|||
end
|
||||
|
||||
def info
|
||||
begin
|
||||
Info.new(:root_url => url, :lastrev => lastrev('',nil))
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
Info.new(:root_url => url, :lastrev => lastrev('',nil))
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
|
||||
def branches
|
||||
|
@ -82,8 +82,8 @@ module Redmine
|
|||
git_cmd(cmd_args) do |io|
|
||||
io.each_line do |line|
|
||||
branch_rev = line.match('\s*(\*?)\s*(.*?)\s*([0-9a-f]{40}).*$')
|
||||
bran = GitBranch.new(branch_rev[2])
|
||||
next unless branch_rev
|
||||
bran = GitBranch.new(scm_iconv('UTF-8', @path_encoding, branch_rev[2]))
|
||||
bran.revision = branch_rev[3]
|
||||
bran.scmid = branch_rev[3]
|
||||
bran.is_default = ( branch_rev[1] == '*' )
|
||||
|
@ -100,7 +100,7 @@ module Redmine
|
|||
@tags = []
|
||||
cmd_args = %w|tag|
|
||||
git_cmd(cmd_args) do |io|
|
||||
@tags = io.readlines.sort!.map{|t| t.strip}
|
||||
@tags = io.readlines.sort!.map{|t| scm_iconv('UTF-8', @path_encoding, t.strip)}
|
||||
end
|
||||
@tags
|
||||
rescue ScmCommandAborted
|
||||
|
@ -109,11 +109,11 @@ module Redmine
|
|||
|
||||
def default_branch
|
||||
bras = self.branches
|
||||
return nil if bras.nil?
|
||||
default_bras = bras.select{|x| x.is_default == true}
|
||||
return default_bras.first.to_s if ! default_bras.empty?
|
||||
master_bras = bras.select{|x| x.to_s == 'master'}
|
||||
master_bras.empty? ? bras.first.to_s : 'master'
|
||||
return unless bras
|
||||
default_bras = bras.detect{|x| x.is_default == true}
|
||||
return default_bras.to_s if default_bras
|
||||
master_bras = bras.detect{|x| x.to_s == 'master'}
|
||||
master_bras ? 'master' : bras.first.to_s
|
||||
end
|
||||
|
||||
def entry(path=nil, identifier=nil)
|
||||
|
@ -136,8 +136,9 @@ module Redmine
|
|||
p = scm_iconv(@path_encoding, 'UTF-8', path)
|
||||
entries = Entries.new
|
||||
cmd_args = %w|ls-tree -l|
|
||||
cmd_args << "HEAD:#{p}" if identifier.nil?
|
||||
cmd_args << "#{identifier}:#{p}" if identifier
|
||||
identifier = 'HEAD' if identifier.nil?
|
||||
git_identifier = scm_iconv(@path_encoding, 'UTF-8', identifier)
|
||||
cmd_args << "#{git_identifier}:#{p}"
|
||||
git_cmd(cmd_args) do |io|
|
||||
io.each_line do |line|
|
||||
e = line.chomp.to_s
|
||||
|
@ -198,13 +199,19 @@ module Redmine
|
|||
cmd_args = %w|log --no-color --encoding=UTF-8 --raw --date=iso --pretty=fuller --parents --stdin|
|
||||
cmd_args << '--no-renames' if self.class.client_version_above?([2, 9])
|
||||
cmd_args << "--reverse" if options[:reverse]
|
||||
cmd_args << "-n" << "#{options[:limit].to_i}" if options[:limit]
|
||||
cmd_args << "-n" << options[:limit].to_i.to_s if options[:limit]
|
||||
cmd_args << "--" << scm_iconv(@path_encoding, 'UTF-8', path) if path && !path.empty?
|
||||
revisions = []
|
||||
if identifier_from || identifier_to
|
||||
revisions << ""
|
||||
revisions[0] << "#{identifier_from}.." if identifier_from
|
||||
revisions[0] << "#{identifier_to}" if identifier_to
|
||||
revisions << +""
|
||||
if identifier_from
|
||||
git_identifier_from = scm_iconv(@path_encoding, 'UTF-8', identifier_from)
|
||||
revisions[0] << "#{git_identifier_from}.." if identifier_from
|
||||
end
|
||||
if identifier_to
|
||||
git_identifier_to = scm_iconv(@path_encoding, 'UTF-8', identifier_to)
|
||||
revisions[0] << git_identifier_to.to_s if identifier_to
|
||||
end
|
||||
else
|
||||
unless options[:includes].blank?
|
||||
revisions += options[:includes]
|
||||
|
@ -220,14 +227,15 @@ module Redmine
|
|||
io.close_write
|
||||
files=[]
|
||||
changeset = {}
|
||||
parsing_descr = 0 #0: not parsing desc or files, 1: parsing desc, 2: parsing files
|
||||
# 0: not parsing desc or files, 1: parsing desc, 2: parsing files
|
||||
parsing_descr = 0
|
||||
|
||||
io.each_line do |line|
|
||||
if line =~ /^commit ([0-9a-f]{40})(( [0-9a-f]{40})*)$/
|
||||
key = "commit"
|
||||
value = $1
|
||||
parents_str = $2
|
||||
if (parsing_descr == 1 || parsing_descr == 2)
|
||||
if [1, 2].include?(parsing_descr)
|
||||
parsing_descr = 0
|
||||
revision = Revision.new({
|
||||
:identifier => changeset[:commit],
|
||||
|
@ -260,16 +268,16 @@ module Redmine
|
|||
end
|
||||
elsif (parsing_descr == 0) && line.chomp.to_s == ""
|
||||
parsing_descr = 1
|
||||
changeset[:description] = ""
|
||||
elsif (parsing_descr == 1 || parsing_descr == 2) \
|
||||
&& line =~ /^:\d+\s+\d+\s+[0-9a-f.]+\s+[0-9a-f.]+\s+(\w)\t(.+)$/
|
||||
changeset[:description] = +""
|
||||
elsif [1, 2].include?(parsing_descr) &&
|
||||
line =~ /^:\d+\s+\d+\s+[0-9a-f.]+\s+[0-9a-f.]+\s+(\w)\t(.+)$/
|
||||
parsing_descr = 2
|
||||
fileaction = $1
|
||||
filepath = $2
|
||||
p = scm_iconv('UTF-8', @path_encoding, filepath)
|
||||
files << {:action => fileaction, :path => p}
|
||||
elsif (parsing_descr == 1 || parsing_descr == 2) \
|
||||
&& line =~ /^:\d+\s+\d+\s+[0-9a-f.]+\s+[0-9a-f.]+\s+(\w)\d+\s+(\S+)\t(.+)$/
|
||||
elsif [1, 2].include?(parsing_descr) &&
|
||||
line =~ /^:\d+\s+\d+\s+[0-9a-f.]+\s+[0-9a-f.]+\s+(\w)\d+\s+(\S+)\t(.+)$/
|
||||
parsing_descr = 2
|
||||
fileaction = $1
|
||||
filepath = $3
|
||||
|
@ -333,8 +341,9 @@ module Redmine
|
|||
|
||||
def annotate(path, identifier=nil)
|
||||
identifier = 'HEAD' if identifier.blank?
|
||||
git_identifier = scm_iconv(@path_encoding, 'UTF-8', identifier)
|
||||
cmd_args = %w|blame --encoding=UTF-8|
|
||||
cmd_args << "-p" << identifier << "--" << scm_iconv(@path_encoding, 'UTF-8', path)
|
||||
cmd_args << "-p" << git_identifier << "--" << scm_iconv(@path_encoding, 'UTF-8', path)
|
||||
blame = Annotate.new
|
||||
content = nil
|
||||
git_cmd(cmd_args) { |io| io.binmode; content = io.read }
|
||||
|
@ -365,11 +374,10 @@ module Redmine
|
|||
end
|
||||
|
||||
def cat(path, identifier=nil)
|
||||
if identifier.nil?
|
||||
identifier = 'HEAD'
|
||||
end
|
||||
identifier = 'HEAD' if identifier.nil?
|
||||
git_identifier = scm_iconv(@path_encoding, 'UTF-8', identifier)
|
||||
cmd_args = %w|show --no-color|
|
||||
cmd_args << "#{identifier}:#{scm_iconv(@path_encoding, 'UTF-8', path)}"
|
||||
cmd_args << "#{git_identifier}:#{scm_iconv(@path_encoding, 'UTF-8', path)}"
|
||||
cat = nil
|
||||
git_cmd(cmd_args) do |io|
|
||||
io.binmode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue