1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

More efficient "svn log" usage (closes #5620)

git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@4828 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jamis Buck 2006-08-27 06:47:25 +00:00
parent 13e64d5d04
commit 71ffb5dc1a
3 changed files with 9 additions and 21 deletions

View file

@ -1,5 +1,7 @@
*SVN* *SVN*
* More efficient "svn log" usage (closes #5620) [Anatol Pomozov]
* Better support for key passphrases in the SVN module (closes #5920) [llasram@gmail.com] * Better support for key passphrases in the SVN module (closes #5920) [llasram@gmail.com]
* Fix missing default for :local in cvs.rb (closes #3645) [jeremy@hinegardner.org] * Fix missing default for :local in cvs.rb (closes #3645) [jeremy@hinegardner.org]

View file

@ -16,23 +16,15 @@ module Capistrano
# set :svn, "/opt/local/bin/svn" # set :svn, "/opt/local/bin/svn"
class Subversion < Base class Subversion < Base
# Return an integer identifying the last known revision in the svn # Return an integer identifying the last known revision in the svn
# repository. (This integer is currently the revision number.) If latest # repository. (This integer is currently the revision number.)
# revision does not exist in the given repository, this routine will
# walk up the directory tree until it finds it.
def latest_revision def latest_revision
configuration.logger.debug "querying latest revision..." unless @latest_revision @latest_revision ||= begin
repo = configuration.repository configuration.logger.debug "querying latest revision..."
until @latest_revision match = svn_log(configuration.repository).scan(/r(\d+)/).first or
match = svn_log(repo).scan(/r(\d+)/).first raise "Could not determine latest revision"
@latest_revision = match ? match.first : nil match.first
if @latest_revision.nil?
# if a revision number was not reported, move up a level in the path
# and try again.
repo = File.dirname(repo)
end end
end end
@latest_revision
end
# Return the number of the revision currently deployed. # Return the number of the revision currently deployed.
def current_revision(actor) def current_revision(actor)
@ -87,7 +79,7 @@ module Capistrano
end end
def svn_log(path) def svn_log(path)
`svn log -q -rhead #{path}` `svn log -q --limit 1 #{path}`
end end
def svn_password def svn_password

View file

@ -74,12 +74,6 @@ MSG
assert_equal "/hello/world", @scm.last_path assert_equal "/hello/world", @scm.last_path
end end
def test_latest_revision_searching_upwards
@scm.story = [ "-----------------------------\n", @log_msg ]
assert_equal "1967", @scm.latest_revision
assert_equal "/hello", @scm.last_path
end
def test_checkout def test_checkout
@actor.story = [] @actor.story = []
assert_nothing_raised { @scm.checkout(@actor) } assert_nothing_raised { @scm.checkout(@actor) }