diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-02-18 07:15:37 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-02-18 07:15:37 +0000 |
commit | 68fe853477b847f7c1e6911238eb04de3b37d1ca (patch) | |
tree | 1a538d34ebee7718550e92d8350e1851ef7b7676 /lib/redmine/scm/adapters/mercurial_adapter.rb | |
parent | 8c9be393508f314fac1e3ffa2d66795d1175fff4 (diff) | |
download | redmine-68fe853477b847f7c1e6911238eb04de3b37d1ca.tar.gz redmine-68fe853477b847f7c1e6911238eb04de3b37d1ca.zip |
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
Diffstat (limited to 'lib/redmine/scm/adapters/mercurial_adapter.rb')
-rw-r--r-- | lib/redmine/scm/adapters/mercurial_adapter.rb | 12 |
1 files changed, 12 insertions, 0 deletions
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'] |