From: Toshi MARUYAMA Date: Wed, 25 May 2011 08:05:58 +0000 (+0000) Subject: scm: bazaar: add adapter method to get "append_revisions_only" value from .bzr/branch... X-Git-Tag: 1.3.0~1957 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8b032bccf1583f9024a19811d4f39d71f6b58d81;p=redmine.git scm: bazaar: add adapter method to get "append_revisions_only" value from .bzr/branch/branch.conf (#2799, #4741, #8030). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5892 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/lib/redmine/scm/adapters/bazaar_adapter.rb b/lib/redmine/scm/adapters/bazaar_adapter.rb index 804833a2a..822d51773 100644 --- a/lib/redmine/scm/adapters/bazaar_adapter.rb +++ b/lib/redmine/scm/adapters/bazaar_adapter.rb @@ -234,6 +234,38 @@ module Redmine bcp = File.join(bcp, ".bzr", "branch", "branch.conf") end end + + def append_revisions_only + return @aro if ! @aro.nil? + @aro = false + bcp = self.class.branch_conf_path(url) + if File.exist?(bcp) + begin + f = File::open(bcp, "r") + cnt = 0 + f.each_line do |line| + l = line.chomp.to_s + if l =~ /^\s*append_revisions_only\s*=\s*(\w+)\s*$/ + str_aro = $1 + if str_aro.upcase == "TRUE" + @aro = true + cnt += 1 + elsif str_aro.upcase == "FALSE" + @aro = false + cnt += 1 + end + if cnt > 1 + @aro = false + break + end + end + end + ensure + f.close + end + end + @aro + end end end end