| Class | Capistrano::Deploy::SCM::Subversion |
| In: |
lib/capistrano/recipes/deploy/scm/subversion.rb
lib/capistrano/recipes/deploy/scm/subversion.rb |
| Parent: | Base |
Implements the Capistrano SCM interface for the Subversion revision control system (subversion.tigris.org).
Returns the command that will check out the given revision to the given destination.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 23
23: def checkout(revision, destination)
24: scm :checkout, arguments, verbose, authentication, "-r#{revision}", repository, destination
25: end
Returns the command that will check out the given revision to the given destination.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 23
23: def checkout(revision, destination)
24: scm :checkout, arguments, verbose, authentication, "-r#{revision}", repository, destination
25: end
Returns the command that will do an "svn export" of the given revision to the given destination.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 35
35: def export(revision, destination)
36: scm :export, arguments, verbose, authentication, "-r#{revision}", repository, destination
37: end
Returns the command that will do an "svn export" of the given revision to the given destination.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 35
35: def export(revision, destination)
36: scm :export, arguments, verbose, authentication, "-r#{revision}", repository, destination
37: end
Determines what the response should be for a particular bit of text from the SCM. Password prompts, connection requests, passphrases, etc. are handled here.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 70
70: def handle_data(state, stream, text)
71: host = state[:channel][:host]
72: logger.info "[#{host} :: #{stream}] #{text}"
73: case text
74: when /\bpassword.*:/i
75: # subversion is prompting for a password
76: "#{scm_password_prompt}\n"
77: when %r{\(yes/no\)}
78: # subversion is asking whether or not to connect
79: "yes\n"
80: when /passphrase/i
81: # subversion is asking for the passphrase for the user's key
82: "#{variable(:scm_passphrase)}\n"
83: when /The entry \'(.+?)\' is no longer a directory/
84: raise Capistrano::Error, "subversion can't update because directory '#{$1}' was replaced. Please add it to svn:ignore."
85: when /accept \(t\)emporarily/
86: # subversion is asking whether to accept the certificate
87: "t\n"
88: end
89: end
Determines what the response should be for a particular bit of text from the SCM. Password prompts, connection requests, passphrases, etc. are handled here.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 70
70: def handle_data(state, stream, text)
71: host = state[:channel][:host]
72: logger.info "[#{host} :: #{stream}] #{text}"
73: case text
74: when /\bpassword.*:/i
75: # subversion is prompting for a password
76: "#{scm_password_prompt}\n"
77: when %r{\(yes/no\)}
78: # subversion is asking whether or not to connect
79: "yes\n"
80: when /passphrase/i
81: # subversion is asking for the passphrase for the user's key
82: "#{variable(:scm_passphrase)}\n"
83: when /The entry \'(.+?)\' is no longer a directory/
84: raise Capistrano::Error, "subversion can't update because directory '#{$1}' was replaced. Please add it to svn:ignore."
85: when /accept \(t\)emporarily/
86: # subversion is asking whether to accept the certificate
87: "t\n"
88: end
89: end
Subversion understands ‘HEAD’ to refer to the latest revision in the repository.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 17
17: def head
18: "HEAD"
19: end
Subversion understands ‘HEAD’ to refer to the latest revision in the repository.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 17
17: def head
18: "HEAD"
19: end
Increments the given revision number and returns it.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 63
63: def next_revision(revision)
64: revision.to_i + 1
65: end
Increments the given revision number and returns it.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 63
63: def next_revision(revision)
64: revision.to_i + 1
65: end
Attempts to translate the given revision identifier to a "real" revision. If the identifier is an integer, it will simply be returned. Otherwise, this will yield a string of the commands it needs to be executed (svn info), and will extract the revision from the response.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 53
53: def query_revision(revision)
54: return revision if revision =~ /^\d+$/
55: command = scm(:info, repository, authentication, "-r#{revision}")
56: result = yield(command)
57: yaml = YAML.load(result)
58: raise "tried to run `#{command}' and got unexpected result #{result.inspect}" unless Hash === yaml
59: yaml['Last Changed Rev'] || yaml['Revision']
60: end
Attempts to translate the given revision identifier to a "real" revision. If the identifier is an integer, it will simply be returned. Otherwise, this will yield a string of the commands it needs to be executed (svn info), and will extract the revision from the response.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 53
53: def query_revision(revision)
54: return revision if revision =~ /^\d+$/
55: command = scm(:info, repository, authentication, "-r#{revision}")
56: result = yield(command)
57: yaml = YAML.load(result)
58: raise "tried to run `#{command}' and got unexpected result #{result.inspect}" unless Hash === yaml
59: yaml['Last Changed Rev'] || yaml['Revision']
60: end
Returns the command that will do an "svn update" to the given revision, for the working copy at the given destination.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 29
29: def sync(revision, destination)
30: scm :update, arguments, verbose, authentication, "-r#{revision}", destination
31: end
Returns the command that will do an "svn update" to the given revision, for the working copy at the given destination.
# File lib/capistrano/recipes/deploy/scm/subversion.rb, line 29
29: def sync(revision, destination)
30: scm :update, arguments, verbose, authentication, "-r#{revision}", destination
31: end