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:
parent
13e64d5d04
commit
71ffb5dc1a
3 changed files with 9 additions and 21 deletions
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* More efficient "svn log" usage (closes #5620) [Anatol Pomozov]
|
||||
|
||||
* 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]
|
||||
|
|
|
@ -16,22 +16,14 @@ module Capistrano
|
|||
# set :svn, "/opt/local/bin/svn"
|
||||
class Subversion < Base
|
||||
# Return an integer identifying the last known revision in the svn
|
||||
# repository. (This integer is currently the revision number.) If latest
|
||||
# revision does not exist in the given repository, this routine will
|
||||
# walk up the directory tree until it finds it.
|
||||
# repository. (This integer is currently the revision number.)
|
||||
def latest_revision
|
||||
configuration.logger.debug "querying latest revision..." unless @latest_revision
|
||||
repo = configuration.repository
|
||||
until @latest_revision
|
||||
match = svn_log(repo).scan(/r(\d+)/).first
|
||||
@latest_revision = match ? match.first : nil
|
||||
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)
|
||||
@latest_revision ||= begin
|
||||
configuration.logger.debug "querying latest revision..."
|
||||
match = svn_log(configuration.repository).scan(/r(\d+)/).first or
|
||||
raise "Could not determine latest revision"
|
||||
match.first
|
||||
end
|
||||
end
|
||||
@latest_revision
|
||||
end
|
||||
|
||||
# Return the number of the revision currently deployed.
|
||||
|
@ -87,7 +79,7 @@ module Capistrano
|
|||
end
|
||||
|
||||
def svn_log(path)
|
||||
`svn log -q -rhead #{path}`
|
||||
`svn log -q --limit 1 #{path}`
|
||||
end
|
||||
|
||||
def svn_password
|
||||
|
|
|
@ -74,12 +74,6 @@ MSG
|
|||
assert_equal "/hello/world", @scm.last_path
|
||||
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
|
||||
@actor.story = []
|
||||
assert_nothing_raised { @scm.checkout(@actor) }
|
||||
|
|
Loading…
Reference in a new issue