From 68fe853477b847f7c1e6911238eb04de3b37d1ca Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Fri, 18 Feb 2011 07:15:37 +0000 Subject: [PATCH] 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 --- lib/redmine/scm/adapters/mercurial_adapter.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb index e8531e612..6903f80cf 100644 --- a/lib/redmine/scm/adapters/mercurial_adapter.rb +++ b/lib/redmine/scm/adapters/mercurial_adapter.rb @@ -97,6 +97,18 @@ module Redmine Hash[*alist.flatten] 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 @summary ||= hg 'rhsummary' do |io| ActiveSupport::XmlMini.parse(io.read)['rhsummary']