scm: mercurial: support tags at adapter (#1981).

Contributed by Yuya Nishihara.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4872 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-02-18 07:14:51 +00:00 committed by Eric Davis
parent b2e4dbca6f
commit 0cdbec47b5
1 changed files with 12 additions and 0 deletions

View File

@ -85,6 +85,18 @@ module Redmine
:scmid => tip['node']))
end
def tags
as_ary(summary['repository']['tag']).map { |e| e['name'] }
end
# Returns map of {'tag' => 'nodeid', ...}
def tagmap
alist = as_ary(summary['repository']['tag']).map do |e|
e.values_at('name', 'node')
end
Hash[*alist.flatten]
end
def summary
@summary ||= hg 'rhsummary' do |io|
ActiveSupport::XmlMini.parse(io.read)['rhsummary']