scm: mercurial: support named branches at adapter (#7246).

Contributed by Yuya Nishihara.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4874 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-02-18 07:15:37 +00:00
parent 8c9be39350
commit 68fe853477
1 changed files with 12 additions and 0 deletions

View File

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