1 require File.join(File.dirname(__FILE__), '..', 'vcsrepo')
3 Puppet::Type.type(:vcsrepo).provide(:svn, :parent => Puppet::Provider::Vcsrepo) do
4 desc "Supports Subversion repositories"
6 optional_commands :svn => 'svn',
7 :svnadmin => 'svnadmin',
10 has_features :filesystem_types, :reference_tracking, :basic_auth, :configuration
13 if !@resource.value(:source)
14 create_repository(@resource.value(:path))
16 checkout_repository(@resource.value(:source),
17 @resource.value(:path),
18 @resource.value(:revision))
23 def working_copy_exists?
24 if File.directory?(@resource.value(:path))
25 # :path is an svn checkout
26 return true if File.directory?(File.join(@resource.value(:path), '.svn'))
27 # :path is an svn server
28 return true if svnlook('uuid', @resource.value(:path))
38 FileUtils.rm_rf(@resource.value(:path))
43 self.revision >= self.latest
48 args = ['--non-interactive']
49 if @resource.value(:basic_auth_username) && @resource.value(:basic_auth_password)
50 args.push('--username', @resource.value(:basic_auth_username))
51 args.push('--password', @resource.value(:basic_auth_password))
52 args.push('--no-auth-cache')
55 if @resource.value(:force)
59 if @resource.value(:configuration)
60 args.push('--config-dir', @resource.value(:configuration))
67 args = buildargs.push('info', '-r', 'HEAD')
69 svn(*args)[/^Last Changed Rev:\s+(\d+)/m, 1]
74 args = buildargs.push('info')
76 svn(*args)[/^Last Changed Rev:\s+(\d+)/m, 1]
80 def revision=(desired)
81 args = buildargs.push('update', '-r', desired)
90 def checkout_repository(source, path, revision)
91 args = buildargs.push('checkout')
93 args.push('-r', revision)
95 args.push(source, path)
99 def create_repository(path)
101 if @resource.value(:fstype)
102 args.push('--fs-type', @resource.value(:fstype))
109 if @resource.value(:owner) or @resource.value(:group)