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

Merge branch 'robd-revert-revision-strip'

This commit is contained in:
Lee Hambley 2015-08-10 10:15:43 +02:00
commit a433846398
7 changed files with 10 additions and 9 deletions

View file

@ -13,6 +13,7 @@ https://github.com/capistrano/capistrano/compare/v3.4.0...HEAD
* Added options to set username and password when using Subversion as SCM (@dsthode) * Added options to set username and password when using Subversion as SCM (@dsthode)
* Allow after() to refer to tasks that have not been loaded yet (@jcoglan) * Allow after() to refer to tasks that have not been loaded yet (@jcoglan)
* Ensure scm fetch_revision methods strip trailing whitespace (@mattbrictson) * Ensure scm fetch_revision methods strip trailing whitespace (@mattbrictson)
* Reverted - no longer needed due to [SSHKit PR249](https://github.com/capistrano/sshkit/pull/249) (@robd)
* Allow use "all" as string for server filtering (@theist) * Allow use "all" as string for server filtering (@theist)
* Print a warning and abort if "load:defaults" is erroneously invoked after * Print a warning and abort if "load:defaults" is erroneously invoked after
capistrano is already loaded, e.g. when a plugin is loaded in `deploy.rb` capistrano is already loaded, e.g. when a plugin is loaded in `deploy.rb`

View file

@ -48,7 +48,7 @@ class Capistrano::Git < Capistrano::SCM
end end
def fetch_revision def fetch_revision
context.capture(:git, "rev-list --max-count=1 --abbrev-commit --abbrev=12 #{fetch(:branch)}").strip context.capture(:git, "rev-list --max-count=1 --abbrev-commit --abbrev=12 #{fetch(:branch)}")
end end
end end
end end

View file

@ -37,7 +37,7 @@ class Capistrano::Hg < Capistrano::SCM
end end
def fetch_revision def fetch_revision
context.capture(:hg, "log --rev #{fetch(:branch)} --template \"{node}\n\"").strip context.capture(:hg, "log --rev #{fetch(:branch)} --template \"{node}\n\"")
end end
end end
end end

View file

@ -36,7 +36,7 @@ class Capistrano::Svn < Capistrano::SCM
end end
def fetch_revision def fetch_revision
context.capture(:svnversion, repo_path).strip context.capture(:svnversion, repo_path)
end end
end end
end end

View file

@ -97,9 +97,9 @@ module Capistrano
end end
describe "#fetch_revision" do describe "#fetch_revision" do
it "should strip trailing whitespace" do it "should capture git rev-list" do
context.expects(:fetch).with(:branch).returns(:branch) context.expects(:fetch).with(:branch).returns(:branch)
context.expects(:capture).with(:git, "rev-list --max-count=1 --abbrev-commit branch").returns("01abcde\n") context.expects(:capture).with(:git, "rev-list --max-count=1 --abbrev-commit branch").returns("01abcde")
revision = subject.fetch_revision revision = subject.fetch_revision
expect(revision).to eq("01abcde") expect(revision).to eq("01abcde")
end end

View file

@ -79,9 +79,9 @@ module Capistrano
end end
describe "#fetch_revision" do describe "#fetch_revision" do
it "should strip trailing whitespace" do it "should capture hg log" do
context.expects(:fetch).with(:branch).returns(:branch) context.expects(:fetch).with(:branch).returns(:branch)
context.expects(:capture).with(:hg, "log --rev branch --template \"{node}\n\"").returns("01abcde\n") context.expects(:capture).with(:hg, "log --rev branch --template \"{node}\n\"").returns("01abcde")
revision = subject.fetch_revision revision = subject.fetch_revision
expect(revision).to eq("01abcde") expect(revision).to eq("01abcde")
end end

View file

@ -77,10 +77,10 @@ module Capistrano
end end
describe "#fetch_revision" do describe "#fetch_revision" do
it "should run fetch revision and strip trailing whitespace" do it "should capture svn version" do
context.expects(:repo_path).returns(:path) context.expects(:repo_path).returns(:path)
context.expects(:capture).with(:svnversion, :path).returns("12345\n") context.expects(:capture).with(:svnversion, :path).returns("12345")
revision = subject.fetch_revision revision = subject.fetch_revision
expect(revision).to eq("12345") expect(revision).to eq("12345")