]> source.dussan.org Git - redmine.git/commitdiff
scm: bazaar: add adapter method to get "append_revisions_only" value from .bzr/branch...
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 25 May 2011 08:05:58 +0000 (08:05 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 25 May 2011 08:05:58 +0000 (08:05 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5892 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/scm/adapters/bazaar_adapter.rb

index 804833a2a6e19506f4448cf8578304e4b29f6ae3..822d5177307343c820c4b1b396fdd92eac9410e9 100644 (file)
@@ -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