Skip to content

Commit

Permalink
Merge pull request capistrano#1573 from marcovtwout/svn-revision-new
Browse files Browse the repository at this point in the history
Added option to set specific revision when using Subversion as SCM
  • Loading branch information
mattbrictson committed Jan 26, 2016
2 parents a19b0d9 + 1b3d98a commit 012929e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ https://github.com/capistrano/capistrano/compare/v3.4.0...HEAD
* Deduplicate list of linked directories
* Allow dot in :application name (@marcovtwout)
* Fixed git-ssh permission error (@spight)
* Added option to set specific revision when using Subversion as SCM (@marcovtwout)

## `3.4.0`

Expand Down
1 change: 1 addition & 0 deletions lib/capistrano/svn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def svn(*args)
args.unshift(:svn)
args.push "--username #{fetch(:svn_username)}" if fetch(:svn_username)
args.push "--password #{fetch(:svn_password)}" if fetch(:svn_password)
args.push "--revision #{fetch(:svn_revision)}" if fetch(:svn_revision)
context.execute(*args)
end

Expand Down
15 changes: 15 additions & 0 deletions spec/lib/capistrano/svn_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module Capistrano
context.expects(:execute).with(:svn, :init, '--username someuser', '--password somepassword')
context.expects(:fetch).twice.with(:svn_username).returns('someuser')
context.expects(:fetch).twice.with(:svn_password).returns('somepassword')
context.expects(:fetch).once.with(:svn_revision).returns(nil)
subject.svn(:init)
end
end
Expand Down Expand Up @@ -47,6 +48,7 @@ module Capistrano
context.expects(:repo_path).returns(:path)
context.expects(:fetch).twice.with(:svn_username).returns('someuser')
context.expects(:fetch).twice.with(:svn_password).returns('somepassword')
context.expects(:fetch).once.with(:svn_revision).returns(nil)

context.expects(:execute).with(:svn, :checkout, :url, :path, '--username someuser', '--password somepassword')

Expand All @@ -59,6 +61,18 @@ module Capistrano
context.expects(:execute).with(:svn, :update, '--username someuser', '--password somepassword')
context.expects(:fetch).twice.with(:svn_username).returns('someuser')
context.expects(:fetch).twice.with(:svn_password).returns('somepassword')
context.expects(:fetch).once.with(:svn_revision).returns(nil)

subject.update
end
end

describe "#update_specific_revision" do
it "should run svn update and update to a specific revision" do
context.expects(:execute).with(:svn, :update, '--username someuser', '--password somepassword', '--revision 12345')
context.expects(:fetch).twice.with(:svn_username).returns('someuser')
context.expects(:fetch).twice.with(:svn_password).returns('somepassword')
context.expects(:fetch).twice.with(:svn_revision).returns('12345')

subject.update
end
Expand All @@ -69,6 +83,7 @@ module Capistrano
context.expects(:release_path).returns(:path)
context.expects(:fetch).twice.with(:svn_username).returns('someuser')
context.expects(:fetch).twice.with(:svn_password).returns('somepassword')
context.expects(:fetch).once.with(:svn_revision).returns(nil)

context.expects(:execute).with(:svn, :export, '--force', '.', :path, '--username someuser', '--password somepassword')

Expand Down

0 comments on commit 012929e

Please sign in to comment.