Class: BuildTool::VCS::SVN
Overview
Implementation for the subversion version control system (subversion.tigris.org).
Instance Attribute Summary
Attributes inherited from Base
#configuration, #path, #repository
Class Method Summary collapse
Instance Method Summary collapse
-
#checkedout? ⇒ Boolean
Check if the local checkout exists.
-
#fetch ⇒ Object
Fetch from
repository
. -
#init ⇒ Object
Initialize the local repository.
-
#initialize(repository, path = nil) ⇒ SVN
constructor
A new instance of SVN.
-
#last_changed_rev ⇒ Object
Returns the last changed revision on the remote repository.
- #name ⇒ Object
- #rebase ⇒ Object
- #svn(command, wd = path, &block) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(repository, path = nil) ⇒ SVN
Returns a new instance of SVN.
21 22 23 |
# File 'lib/kde-build/vcs/svn.rb', line 21 def initialize( repository, path = nil ) super end |
Class Method Details
.config ⇒ Object
37 38 39 |
# File 'lib/kde-build/vcs/svn.rb', line 37 def self.config SvnConfiguration end |
.svn(command, wd, &block) ⇒ Object
29 30 31 |
# File 'lib/kde-build/vcs/svn.rb', line 29 def self.svn( command, wd, &block ) self.execute( "svn #{command}", wd, &block ) end |
Instance Method Details
#checkedout? ⇒ Boolean
Check if the local checkout exists.
calls VCS::Base::checkedout? and checks if there is a ‘.git’ directory at path
45 46 47 48 49 50 51 52 |
# File 'lib/kde-build/vcs/svn.rb', line 45 def checkedout? return false if !super if !File.exists? "#{path}/.svn" $log.debug("Checkout path #{path} is not a svn repo") return false end return true end |
#fetch ⇒ Object
Fetch from repository
Initializes the local clone if it does not exist.
71 72 73 74 75 76 |
# File 'lib/kde-build/vcs/svn.rb', line 71 def fetch() if !checkedout? init end return true end |
#init ⇒ Object
Initialize the local repository
80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/kde-build/vcs/svn.rb', line 80 def init # Check if path exists if File.exists? path raise SvnError, "Failed to create repository at '#{path}': Path exists" end # Create the directories parent dir. FileUtils.mkdir_p( File.dirname( path ) ) if !$noop # Init the repository if !svn "checkout --depth=infinity #{repository}", File.dirname(path) raise SvnError, "Error during 'svn checkout #{repository}'`: #{$?}" end end |
#last_changed_rev ⇒ Object
Returns the last changed revision on the remote repository. Return 0 if the last changed revision could not be determined.
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/kde-build/vcs/svn.rb', line 56 def last_changed_rev info = Hash.new return 777777 if $noop svn( "info #{repository}", nil ) { |line| key, value = line.chomp.split( ':', 2 ) info[key] = value } version = info["Last Changed Rev"]; return version end |
#name ⇒ Object
25 26 27 |
# File 'lib/kde-build/vcs/svn.rb', line 25 def name "Subversion" end |
#rebase ⇒ Object
95 96 97 |
# File 'lib/kde-build/vcs/svn.rb', line 95 def rebase return svn "update" end |
#svn(command, wd = path, &block) ⇒ Object
33 34 35 |
# File 'lib/kde-build/vcs/svn.rb', line 33 def svn( command, wd = path, &block ) self.class.svn command, wd, &block end |