Class: BuildTool::VCS::GitSvn
- Defined in:
- lib/build-tool/vcs/git-svn.rb
Overview
Implementation for the git-svn version control system.
Defined Under Namespace
Classes: GitSvnError
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #[](var) ⇒ Object
- #[]=(var, val) ⇒ Object
-
#checkedout? ⇒ Boolean
METHOD.
- #clone ⇒ Object
- #configure ⇒ Object
-
#fetch(revision = nil) ⇒ Object
Fetch from
repository
. - #fetching_supported? ⇒ Boolean
- #gc ⇒ Object
- #git ⇒ Object
-
#git_svn(command, wd = local_path, &block) ⇒ Object
Call git-svn with command.
-
#initialize(*args) ⇒ GitSvn
constructor
A new instance of GitSvn.
-
#name ⇒ Object
ATTRIBUTES.
- #rebase ⇒ Object
- #update_externals ⇒ Object
Methods inherited from Base
#apply_patches_after_rebase?, #local_path, #local_path_exist?, #patches_supported?, #recipe, #remote_path, #repository
Constructor Details
#initialize(*args) ⇒ GitSvn
Returns a new instance of GitSvn.
44 45 46 |
# File 'lib/build-tool/vcs/git-svn.rb', line 44 def initialize( *args ) super( *args ) end |
Instance Method Details
#[](var) ⇒ Object
136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/build-tool/vcs/git-svn.rb', line 136 def[]( var ) case var when 'external' return @externals else # *TODO* raise correct exception raise NotImplementedError, "#{var}" end end |
#[]=(var, val) ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/build-tool/vcs/git-svn.rb', line 148 def[]=( var, val ) case var when 'external' tmp = val.split( /#/ ) @externals[tmp[0]] = tmp[1] else # *TODO* raise correct exception raise NotImplementedError, "#{var}" end end |
#checkedout? ⇒ Boolean
METHOD
63 64 65 66 67 68 69 |
# File 'lib/build-tool/vcs/git-svn.rb', line 63 def checkedout? return false if !local_path_exist? if !Pathname.new( local_path ).join( ".git" ).exist? raise Base::VcsError, "Checkout path #{local_path} is not a git repo!" end return true end |
#clone ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/build-tool/vcs/git-svn.rb', line 71 def clone if local_path_exist? raise GitSvnError, "Failed to create repository at '#{local_path}': Path exists" end # Create the directory FileUtils.mkdir_p( local_path ) if !$noop # Init the repository if 0 != ( git_svn "init #{repository.url}/#{remote_path}" ) raise GitSvnError, "Error while initializing the repo `git svn init '#{repository}/#{remote_path}'`: #{$?}" end fetch( "HEAD" ) end |
#configure ⇒ Object
84 85 86 |
# File 'lib/build-tool/vcs/git-svn.rb', line 84 def configure git.configure end |
#fetch(revision = nil) ⇒ Object
Fetch from repository
Initializes the local clone if it does not exist.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/build-tool/vcs/git-svn.rb', line 91 def fetch( revision = nil ) if !checkedout? and !$noop # Beware of looping clone end if revision cmd = "fetch -r#{revision}" else cmd = "fetch" end if ( rc = git_svn( cmd ) ) != 0 raise GitSvnError, "Error while fetching: #{rc}" end update_externals end |
#fetching_supported? ⇒ Boolean
55 56 57 |
# File 'lib/build-tool/vcs/git-svn.rb', line 55 def fetching_supported? true end |
#gc ⇒ Object
106 107 108 |
# File 'lib/build-tool/vcs/git-svn.rb', line 106 def gc git.git( "gc" ) end |
#git ⇒ Object
110 111 112 113 114 115 |
# File 'lib/build-tool/vcs/git-svn.rb', line 110 def git if @git.nil? @git = Git.new( config ) end @git end |
#git_svn(command, wd = local_path, &block) ⇒ Object
Call git-svn with command
118 119 120 121 122 123 124 |
# File 'lib/build-tool/vcs/git-svn.rb', line 118 def git_svn( command, wd = local_path, &block ) rc = self.class.execute( "git svn " + command, wd, &block ) if rc != 0 raise GitSvnError, "git svn #{command || "" } failed with error code #{rc}"; end rc end |
#name ⇒ Object
ATTRIBUTES
51 52 53 |
# File 'lib/build-tool/vcs/git-svn.rb', line 51 def name "git-svn" end |
#rebase ⇒ Object
126 127 128 |
# File 'lib/build-tool/vcs/git-svn.rb', line 126 def rebase git.git( "rebase git-svn" ) end |