Actualiza a Redmine 3.4.13
This commit is contained in:
parent
807ff3308d
commit
ecddcaf1d3
224 changed files with 2222 additions and 1000 deletions
|
@ -33,7 +33,7 @@ module Redmine
|
|||
c.iv = iv
|
||||
e = c.update(text.to_s)
|
||||
e << c.final
|
||||
"aes-256-cbc:" + [e, iv].map {|v| Base64.encode64(v).strip}.join('--')
|
||||
"aes-256-cbc:" + [e, iv].map {|v| Base64.strict_encode64(v)}.join('--')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -486,7 +486,7 @@ module Redmine
|
|||
|
||||
def validate_single_value(custom_field, value, customized=nil)
|
||||
errs = super
|
||||
errs << ::I18n.t('activerecord.errors.messages.not_a_number') unless value.to_s =~ /^[+-]?\d+$/
|
||||
errs << ::I18n.t('activerecord.errors.messages.not_a_number') unless value.to_s.strip =~ /^[+-]?\d+$/
|
||||
errs
|
||||
end
|
||||
|
||||
|
@ -736,6 +736,16 @@ module Redmine
|
|||
options
|
||||
end
|
||||
|
||||
def validate_custom_value(custom_value)
|
||||
values = Array.wrap(custom_value.value).reject {|value| value.to_s == ''}
|
||||
invalid_values = values - possible_custom_value_options(custom_value).map(&:last)
|
||||
if invalid_values.any?
|
||||
[::I18n.t('activerecord.errors.messages.inclusion')]
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
def order_statement(custom_field)
|
||||
if target_class.respond_to?(:fields_for_order_statement)
|
||||
target_class.fields_for_order_statement(value_join_alias(custom_field))
|
||||
|
|
|
@ -81,7 +81,7 @@ module Redmine
|
|||
# below : list unreadable files, but dont link them.
|
||||
:path => utf_8_path,
|
||||
:kind => (File.directory?(t1) ? 'dir' : 'file'),
|
||||
:size => (File.directory?(t1) ? nil : [File.size(t1)].pack('l').unpack('L').first),
|
||||
:size => (File.directory?(t1) ? nil : File.size(t1)),
|
||||
:lastrev =>
|
||||
Revision.new({:time => (File.mtime(t1)) })
|
||||
})
|
||||
|
|
|
@ -83,6 +83,7 @@ module Redmine
|
|||
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.revision = branch_rev[3]
|
||||
bran.scmid = branch_rev[3]
|
||||
bran.is_default = ( branch_rev[1] == '*' )
|
||||
|
|
|
@ -46,14 +46,22 @@ Output example of rhmanifest::
|
|||
</rhmanifest>
|
||||
"""
|
||||
import re, time, cgi, urllib
|
||||
from mercurial import cmdutil, commands, node, error, hg
|
||||
from mercurial import cmdutil, commands, node, error, hg, registrar
|
||||
|
||||
cmdtable = {}
|
||||
command = cmdutil.command(cmdtable)
|
||||
command = registrar.command(cmdtable) if hasattr(registrar, 'command') else cmdutil.command(cmdtable)
|
||||
|
||||
_x = cgi.escape
|
||||
_u = lambda s: cgi.escape(urllib.quote(s))
|
||||
|
||||
def _changectx(repo, rev):
|
||||
if isinstance(rev, str):
|
||||
rev = repo.lookup(rev)
|
||||
if hasattr(repo, 'changectx'):
|
||||
return repo.changectx(rev)
|
||||
else:
|
||||
return repo[rev]
|
||||
|
||||
def _tip(ui, repo):
|
||||
# see mercurial/commands.py:tip
|
||||
def tiprev():
|
||||
|
@ -61,7 +69,7 @@ def _tip(ui, repo):
|
|||
return len(repo) - 1
|
||||
except TypeError: # Mercurial < 1.1
|
||||
return repo.changelog.count() - 1
|
||||
tipctx = repo.changectx(tiprev())
|
||||
tipctx = _changectx(repo, tiprev())
|
||||
ui.write('<tip revision="%d" node="%s"/>\n'
|
||||
% (tipctx.rev(), _x(node.hex(tipctx.node()))))
|
||||
|
||||
|
@ -94,13 +102,18 @@ def _branches(ui, repo):
|
|||
return repo.branchheads(branch, closed=False)
|
||||
except TypeError: # Mercurial < 1.2
|
||||
return repo.branchheads(branch)
|
||||
def lookup(rev, n):
|
||||
try:
|
||||
return repo.lookup(rev)
|
||||
except RuntimeError:
|
||||
return n
|
||||
for t, n, r in sorted(iterbranches(), key=lambda e: e[2], reverse=True):
|
||||
if repo.lookup(r) in branchheads(t):
|
||||
if lookup(r, n) in branchheads(t):
|
||||
ui.write('<branch revision="%d" node="%s" name="%s"/>\n'
|
||||
% (r, _x(node.hex(n)), _x(t)))
|
||||
|
||||
def _manifest(ui, repo, path, rev):
|
||||
ctx = repo.changectx(rev)
|
||||
ctx = _changectx(repo, rev)
|
||||
ui.write('<manifest revision="%d" path="%s">\n'
|
||||
% (ctx.rev(), _u(path)))
|
||||
|
||||
|
@ -155,7 +168,7 @@ def rhdiff(ui, repo, *pats, **opts):
|
|||
"""diff repository (or selected files)"""
|
||||
change = opts.pop('change', None)
|
||||
if change: # add -c option for Mercurial<1.1
|
||||
base = repo.changectx(change).parents()[0].rev()
|
||||
base = _changectx(repo, change).parents()[0].rev()
|
||||
opts['rev'] = [str(base), change]
|
||||
opts['nodates'] = True
|
||||
return commands.diff(ui, repo, *map(urllib.unquote_plus, pats), **opts)
|
||||
|
|
|
@ -87,6 +87,7 @@ module Redmine
|
|||
private
|
||||
|
||||
def normalize!
|
||||
self.reject! {|s| s.first.blank? }
|
||||
self.collect! {|s| s = Array(s); [s.first, (s.last == false || s.last.to_s == 'desc') ? 'desc' : 'asc']}
|
||||
self.slice!(3)
|
||||
self
|
||||
|
|
|
@ -49,7 +49,12 @@ module Redmine
|
|||
|
||||
def self.convert_available?
|
||||
return @convert_available if defined?(@convert_available)
|
||||
@convert_available = system("#{shell_quote CONVERT_BIN} -version") rescue false
|
||||
begin
|
||||
`#{shell_quote CONVERT_BIN} -version`
|
||||
@convert_available = $?.success?
|
||||
rescue
|
||||
@convert_available = false
|
||||
end
|
||||
logger.warn("Imagemagick's convert binary (#{CONVERT_BIN}) not available") unless @convert_available
|
||||
@convert_available
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ module Redmine
|
|||
module VERSION #:nodoc:
|
||||
MAJOR = 3
|
||||
MINOR = 4
|
||||
TINY = 4
|
||||
TINY = 13
|
||||
|
||||
# Branch values:
|
||||
# * official release: nil
|
||||
|
|
|
@ -48,7 +48,7 @@ module Redmine
|
|||
end
|
||||
|
||||
def method_missing(sym, *args, &block)
|
||||
if args.any?
|
||||
if args.count > 0
|
||||
if args.first.is_a?(Hash)
|
||||
if @struct.last.is_a?(Array)
|
||||
@struct.last << args.first unless block
|
||||
|
|
|
@ -94,15 +94,13 @@ module Redmine
|
|||
i = 0
|
||||
l = 1
|
||||
inside_pre = false
|
||||
@text.split(/(^(?:.+\r?\n\r?(?:\=+|\-+)|#+.+|~~~.*)\s*$)/).each do |part|
|
||||
@text.split(/(^(?:.+\r?\n\r?(?:\=+|\-+)|#+.+|(?:~~~|```).*)\s*$)/).each do |part|
|
||||
level = nil
|
||||
if part =~ /\A~{3,}(\S+)?\s*$/
|
||||
if $1
|
||||
if !inside_pre
|
||||
inside_pre = true
|
||||
end
|
||||
else
|
||||
inside_pre = !inside_pre
|
||||
if part =~ /\A(~{3,}|`{3,})(\S+)?\s*$/
|
||||
if !inside_pre
|
||||
inside_pre = true
|
||||
elsif !$2
|
||||
inside_pre = false
|
||||
end
|
||||
elsif inside_pre
|
||||
# nop
|
||||
|
@ -142,7 +140,8 @@ module Redmine
|
|||
:strikethrough => true,
|
||||
:superscript => true,
|
||||
:no_intra_emphasis => true,
|
||||
:footnotes => true
|
||||
:footnotes => true,
|
||||
:lax_spacing => true
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -120,9 +120,10 @@ module Redmine
|
|||
## replace <pre> content
|
||||
text.gsub!(/<redpre#(\d+)>/) do
|
||||
content = @pre_list[$1.to_i]
|
||||
if content.match(/<code\s+class="(\w+)">\s?(.+)/m)
|
||||
language = $1
|
||||
text = $2
|
||||
# This regex must match any data produced by RedCloth3#rip_offtags
|
||||
if content.match(/<code\s+class=(?:"([^"]+)"|'([^']+)')>\s?(.*)/m)
|
||||
language = $1 || $2
|
||||
text = $3
|
||||
if Redmine::SyntaxHighlighting.language_supported?(language)
|
||||
content = "<code class=\"#{language} syntaxhl\">" +
|
||||
Redmine::SyntaxHighlighting.highlight_by_language(text, language)
|
||||
|
|
|
@ -343,7 +343,7 @@ class RedCloth3 < String
|
|||
A_VLGN = /[\-^~]/
|
||||
C_CLAS = '(?:\([^")]+\))'
|
||||
C_LNGE = '(?:\[[a-z\-_]+\])'
|
||||
C_STYL = '(?:\{[^"}]+\})'
|
||||
C_STYL = '(?:\{[^{][^"}]+\})'
|
||||
S_CSPN = '(?:\\\\\d+)'
|
||||
S_RSPN = '(?:/\d+)'
|
||||
A = "(?:#{A_HLGN}?#{A_VLGN}?|#{A_VLGN}?#{A_HLGN}?)"
|
||||
|
@ -1034,7 +1034,7 @@ class RedCloth3 < String
|
|||
def flush_left( text )
|
||||
indt = 0
|
||||
if text =~ /^ /
|
||||
while text !~ /^ {#{indt}}\S/
|
||||
while text !~ /^ {#{indt}}[^ ]/
|
||||
indt += 1
|
||||
end unless text.empty?
|
||||
if indt.nonzero?
|
||||
|
@ -1049,7 +1049,7 @@ class RedCloth3 < String
|
|||
end
|
||||
|
||||
OFFTAGS = /(code|pre|kbd|notextile)/
|
||||
OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }>)|(<#{ OFFTAGS }[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }\W|\Z)/mi
|
||||
OFFTAG_MATCH = /(?:(<\/#{ OFFTAGS }\b>)|(<#{ OFFTAGS }\b[^>]*>))(.*?)(?=<\/?#{ OFFTAGS }\b\W|\Z)/mi
|
||||
OFFTAG_OPEN = /<#{ OFFTAGS }/
|
||||
OFFTAG_CLOSE = /<\/?#{ OFFTAGS }/
|
||||
HASTAG_MATCH = /(<\/?\w[^\n]*?>)/m
|
||||
|
@ -1213,7 +1213,13 @@ class RedCloth3 < String
|
|||
|
||||
ALLOWED_TAGS = %w(redpre pre code kbd notextile)
|
||||
def escape_html_tags(text)
|
||||
text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) {|m| ALLOWED_TAGS.include?($2) ? "<#{$1}#{$3}" : "<#{$1}#{'>' unless $3.blank?}" }
|
||||
text.gsub!(%r{<(\/?([!\w]+)[^<>\n]*)(>?)}) do |m|
|
||||
if ALLOWED_TAGS.include?($2) && $3.present?
|
||||
"<#{$1}#{$3}"
|
||||
else
|
||||
"<#{$1}#{'>' unless $3.blank?}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue