mirror of
https://github.com/redmine/redmine.git
synced 2025-12-16 05:20:28 +01:00
scm: mercurial: escape branch and tag names (#27790)
git-svn-id: http://svn.redmine.org/redmine/trunk@19765 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -85,7 +85,7 @@ def _tags(ui, repo):
|
||||
except error.LookupError:
|
||||
continue
|
||||
ui.write('<tag revision="%d" node="%s" name="%s"/>\n'
|
||||
% (r, _x(node.hex(n)), _x(t)))
|
||||
% (r, _x(node.hex(n)), _u(t)))
|
||||
|
||||
def _branches(ui, repo):
|
||||
# see mercurial/commands.py:branches
|
||||
@@ -110,7 +110,7 @@ def _branches(ui, repo):
|
||||
for t, n, r in sorted(iterbranches(), key=lambda e: e[2], reverse=True):
|
||||
if lookup(r, n) in branchheads(t):
|
||||
ui.write('<branch revision="%d" node="%s" name="%s"/>\n'
|
||||
% (r, _x(node.hex(n)), _x(t)))
|
||||
% (r, _x(node.hex(n)), _u(t)))
|
||||
|
||||
def _manifest(ui, repo, path, rev):
|
||||
ctx = _changectx(repo, rev)
|
||||
|
||||
@@ -97,21 +97,22 @@ module Redmine
|
||||
end
|
||||
|
||||
def tags
|
||||
as_ary(summary['repository']['tag']).map { |e| e['name'] }
|
||||
as_ary(summary['repository']['tag']).map {|e| CGI.unescape(e['name'])}
|
||||
end
|
||||
|
||||
# Returns map of {'tag' => 'nodeid', ...}
|
||||
def tagmap
|
||||
alist = as_ary(summary['repository']['tag']).map do |e|
|
||||
e.values_at('name', 'node')
|
||||
map = {}
|
||||
as_ary(summary['repository']['tag']).each do |e|
|
||||
map[CGI.unescape(e['name'])] = e['node']
|
||||
end
|
||||
Hash[*alist.flatten]
|
||||
map
|
||||
end
|
||||
|
||||
def branches
|
||||
brs = []
|
||||
as_ary(summary['repository']['branch']).each do |e|
|
||||
br = Branch.new(e['name'])
|
||||
br = Branch.new(CGI.unescape(e['name']))
|
||||
br.revision = e['revision']
|
||||
br.scmid = e['node']
|
||||
brs << br
|
||||
@@ -121,10 +122,11 @@ module Redmine
|
||||
|
||||
# Returns map of {'branch' => 'nodeid', ...}
|
||||
def branchmap
|
||||
alist = as_ary(summary['repository']['branch']).map do |e|
|
||||
e.values_at('name', 'node')
|
||||
map = {}
|
||||
branches.each do |b|
|
||||
map[b.to_s] = b.scmid
|
||||
end
|
||||
Hash[*alist.flatten]
|
||||
map
|
||||
end
|
||||
|
||||
def summary
|
||||
|
||||
Reference in New Issue
Block a user