mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00: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:
parent
07d14ce721
commit
45c8e9e03a
@ -85,7 +85,7 @@ def _tags(ui, repo):
|
|||||||
except error.LookupError:
|
except error.LookupError:
|
||||||
continue
|
continue
|
||||||
ui.write('<tag revision="%d" node="%s" name="%s"/>\n'
|
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):
|
def _branches(ui, repo):
|
||||||
# see mercurial/commands.py:branches
|
# 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):
|
for t, n, r in sorted(iterbranches(), key=lambda e: e[2], reverse=True):
|
||||||
if lookup(r, n) in branchheads(t):
|
if lookup(r, n) in branchheads(t):
|
||||||
ui.write('<branch revision="%d" node="%s" name="%s"/>\n'
|
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):
|
def _manifest(ui, repo, path, rev):
|
||||||
ctx = _changectx(repo, rev)
|
ctx = _changectx(repo, rev)
|
||||||
|
|||||||
@ -97,21 +97,22 @@ module Redmine
|
|||||||
end
|
end
|
||||||
|
|
||||||
def tags
|
def tags
|
||||||
as_ary(summary['repository']['tag']).map { |e| e['name'] }
|
as_ary(summary['repository']['tag']).map {|e| CGI.unescape(e['name'])}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns map of {'tag' => 'nodeid', ...}
|
# Returns map of {'tag' => 'nodeid', ...}
|
||||||
def tagmap
|
def tagmap
|
||||||
alist = as_ary(summary['repository']['tag']).map do |e|
|
map = {}
|
||||||
e.values_at('name', 'node')
|
as_ary(summary['repository']['tag']).each do |e|
|
||||||
|
map[CGI.unescape(e['name'])] = e['node']
|
||||||
end
|
end
|
||||||
Hash[*alist.flatten]
|
map
|
||||||
end
|
end
|
||||||
|
|
||||||
def branches
|
def branches
|
||||||
brs = []
|
brs = []
|
||||||
as_ary(summary['repository']['branch']).each do |e|
|
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.revision = e['revision']
|
||||||
br.scmid = e['node']
|
br.scmid = e['node']
|
||||||
brs << br
|
brs << br
|
||||||
@ -121,10 +122,11 @@ module Redmine
|
|||||||
|
|
||||||
# Returns map of {'branch' => 'nodeid', ...}
|
# Returns map of {'branch' => 'nodeid', ...}
|
||||||
def branchmap
|
def branchmap
|
||||||
alist = as_ary(summary['repository']['branch']).map do |e|
|
map = {}
|
||||||
e.values_at('name', 'node')
|
branches.each do |b|
|
||||||
|
map[b.to_s] = b.scmid
|
||||||
end
|
end
|
||||||
Hash[*alist.flatten]
|
map
|
||||||
end
|
end
|
||||||
|
|
||||||
def summary
|
def summary
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user