mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Display a deprecation error if a remote git branch is specified
Capistrano 2.2 allowed you to do this: set :branch, "origin/release" In capistrano 2.3, the correct syntax is now: set :branch, "release" This change will cause capistrano to show a helpful error message for those upgraders who have been using the 'origin/release' syntax.
This commit is contained in:
parent
32d0b9a7df
commit
3777ddcd57
2 changed files with 8 additions and 1 deletions
|
@ -208,12 +208,13 @@ module Capistrano
|
|||
# Getting the actual commit id, in case we were passed a tag
|
||||
# or partial sha or something - it will return the sha if you pass a sha, too
|
||||
def query_revision(revision)
|
||||
raise ArgumentError, "Deploying remote branches has been deprecated. Specify the remote branch as a local branch for the git repository you're deploying from (ie: '#{revision.gsub('origin/', '')}' rather than '#{revision}')." if revision =~ /^origin\//
|
||||
return revision if revision =~ /^[0-9a-f]{40}$/
|
||||
command = scm('ls-remote', repository, revision)
|
||||
result = yield(command)
|
||||
revdata = result.split("\t")
|
||||
newrev = revdata[0]
|
||||
raise "Unable to resolve revision for #{revision}" unless newrev =~ /^[0-9a-f]{40}$/
|
||||
raise "Unable to resolve revision for '#{revision}' on repository '#{repository}'." unless newrev =~ /^[0-9a-f]{40}$/
|
||||
return newrev
|
||||
end
|
||||
|
||||
|
|
|
@ -57,6 +57,12 @@ class DeploySCMGitTest < Test::Unit::TestCase
|
|||
assert_equal "d11006102c07c94e5d54dd0ee63dca825c93ed61", revision
|
||||
end
|
||||
|
||||
def test_query_revision_deprecation_error
|
||||
assert_raise(ArgumentError) do
|
||||
revision = @source.query_revision('origin/release') {}
|
||||
end
|
||||
end
|
||||
|
||||
def test_command_should_be_backwards_compatible
|
||||
# 1.x version of this module used ":git", not ":scm_command"
|
||||
@config[:git] = "/srv/bin/git"
|
||||
|
|
Loading…
Reference in a new issue