Class: BuildTool::VCS::Svn
Overview
Implementation for the subversion version control system.
Defined Under Namespace
Classes: SvnError
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #[](var) ⇒ Object
- #[]=(var, val) ⇒ Object
-
#checkedout? ⇒ Boolean
METHODS.
-
#clone ⇒ Object
Initialize the local repository.
- #fetch ⇒ Object
- #fetching_supported? ⇒ Boolean
-
#last_changed_rev ⇒ Object
Returns the last changed revision on the remote repository.
-
#name ⇒ Object
ATTRIBUTES.
- #rebase ⇒ Object
-
#svn(command, wd = local_path, &block) ⇒ Object
Call svn with command.
Methods inherited from Base
#apply_patches_after_rebase?, #configure, #gc, #initialize, #local_path, #local_path_exist?, #patches_supported?, #recipe, #remote_path, #repository
Constructor Details
This class inherits a constructor from BuildTool::VCS::Base
Class Method Details
.svn(command, wd, &block) ⇒ Object
120 121 122 123 124 125 126 |
# File 'lib/build-tool/vcs/svn.rb', line 120 def self.svn( command, wd, &block ) rc = self.execute( "svn " + command, wd, &block ) if rc != 0 raise SvnError, "Command 'svn #{command}' failed with error code #{rc}!" end rc end |
Instance Method Details
#[](var) ⇒ Object
133 134 135 136 137 138 139 140 141 142 |
# File 'lib/build-tool/vcs/svn.rb', line 133 def[]( var ) case var when nil else # *TODO* raise correct exception raise NotImplementedError, "#{var}" end end |
#[]=(var, val) ⇒ Object
144 145 146 147 148 149 150 151 152 153 |
# File 'lib/build-tool/vcs/svn.rb', line 144 def[]=( var, val ) case var when nil else # *TODO* raise correct exception raise NotImplementedError, "#{var}" end end |
#checkedout? ⇒ Boolean
METHODS
61 62 63 64 65 66 67 68 |
# File 'lib/build-tool/vcs/svn.rb', line 61 def checkedout? return false if !local_path_exist? if !File.exists? "#{local_path}/.svn" logger.debug("Checkout path #{local_path} is not a svn repo") return false end return true end |
#clone ⇒ Object
Initialize the local repository
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/build-tool/vcs/svn.rb', line 71 def clone # Check if local_path exists if local_path_exist? raise SvnError, "Failed to create repository at '#{local_path}': Path exists" end # Create the directories parent dir. FileUtils.mkdir_p( File.dirname( local_path ) ) if !$noop # Init the repository if config.only svn "checkout --depth=files #{repository.url}/#{remote_path} #{local_path}", local_path.dirname config.only.each do |elem| svn "update --depth=infinity #{elem}", local_path end else svn "checkout --depth=infinity #{repository.url}/#{remote_path} #{local_path}", local_path.dirname end end |
#fetch ⇒ Object
91 92 93 94 95 96 97 98 |
# File 'lib/build-tool/vcs/svn.rb', line 91 def fetch() if !checkedout? clone else svn "update" end return true end |
#fetching_supported? ⇒ Boolean
52 53 54 |
# File 'lib/build-tool/vcs/svn.rb', line 52 def fetching_supported? false 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.
102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/build-tool/vcs/svn.rb', line 102 def last_changed_rev info = Hash.new svn( "info #{repository.url}/#{remote_path}", nil ) { |line| key, value = line.chomp.split( ':', 2 ) info[key] = value } return 777777 if $noop version = info["Last Changed Rev"]; raise SvnError, "Failed to determine revision for #{repository.url}/#{remote_path}" if version.nil? return version end |
#name ⇒ Object
ATTRIBUTES
48 49 50 |
# File 'lib/build-tool/vcs/svn.rb', line 48 def name "svn" end |
#rebase ⇒ Object
128 129 130 131 |
# File 'lib/build-tool/vcs/svn.rb', line 128 def rebase # Rebasing is not supported 0 end |
#svn(command, wd = local_path, &block) ⇒ Object
Call svn with command
116 117 118 |
# File 'lib/build-tool/vcs/svn.rb', line 116 def svn( command, wd = local_path, &block ) self.class.svn( command, wd, &block ) end |