Skip to content

Commit

Permalink
fixes #17 updateでリビジョンを指定できるように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
tkusukawa committed Aug 10, 2013
1 parent 33c3ba6 commit 43613ed
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/yggdrasil.rb
Expand Up @@ -79,6 +79,7 @@ def sync_mirror
updates = Array.new
FileUtils.cd @mirror_dir do
cmd = "#@svn update --no-auth-cache --non-interactive"
cmd += " -r #{@options[:revision]}" if @options.has_key?(:revision)
cmd += username_password_options_to_read_repo
system3(cmd)
cmd = "#@svn ls #@repo -R --no-auth-cache --non-interactive"
Expand Down
4 changes: 2 additions & 2 deletions lib/yggdrasil/diff.rb
Expand Up @@ -4,7 +4,7 @@ class Yggdrasil
def diff(args)
parse_options(args,
{'--username'=>:username, '--password'=>:password,
'-r'=>:revision, '--revision'=>:revision})
'-r'=>:diff_rev, '--revision'=>:diff_rev})
@arg_paths << '/' if @arg_paths.size == 0

get_user_pass_if_need_to_read_repo
Expand Down Expand Up @@ -33,7 +33,7 @@ def diff(args)
cmd_arg = "#@svn diff --no-auth-cache --non-interactive"
cmd_arg += username_password_options_to_read_repo
cmd_arg += ' ' + @arg_options.join(' ') if @arg_options.size != 0
cmd_arg += " -r #{@options[:revision]}" if @options.has_key?(:revision)
cmd_arg += " -r #{@options[:diff_rev]}" if @options.has_key?(:diff_rev)
cmd_arg += ' ' + paths.join(' ')
FileUtils.cd @mirror_dir do
puts system3(cmd_arg)
Expand Down
1 change: 1 addition & 0 deletions lib/yggdrasil/help.rb
Expand Up @@ -171,6 +171,7 @@ def help(args)
--username ARG : specify a username ARG
--password ARG : specify a password ARG
--non-interactive : do no interactive prompting
-r [--revision] ARG : revision number
EOS

Expand Down
1 change: 1 addition & 0 deletions lib/yggdrasil/update.rb
Expand Up @@ -4,6 +4,7 @@ class Yggdrasil
def update(args)
parse_options(args,
{'--username'=>:username, '--password'=>:password,
'-r'=>:revision, '--revision'=>:revision,
'--non-interactive'=>:non_interactive?})
@arg_paths << '/' if @arg_paths.size == 0
get_user_pass_if_need_to_read_repo
Expand Down
2 changes: 2 additions & 0 deletions spec/help_spec.rb
Expand Up @@ -232,6 +232,7 @@
--username ARG : specify a username ARG
--password ARG : specify a password ARG
--non-interactive : do no interactive prompting
-r [--revision] ARG : revision number
EOS
end
Expand All @@ -247,6 +248,7 @@
--username ARG : specify a username ARG
--password ARG : specify a password ARG
--non-interactive : do no interactive prompting
-r [--revision] ARG : revision number
EOS
end
Expand Down
16 changes: 16 additions & 0 deletions spec/update_spec.rb
Expand Up @@ -69,4 +69,20 @@
`cat /tmp/yggdrasil-test/A`.should == "A:no path\n"
`cat /tmp/yggdrasil-test/B`.should == "B:no path\n"
end

it 'should success update with revision' do
puts '---- should success update with revision'
`echo A:hoge > /tmp/yggdrasil-test/A`
`echo B:hoge > /tmp/yggdrasil-test/B`
Yggdrasil.command %w{commit} +
%w{-m hoge} +
%w{--username hoge --password foo --non-interactive}

FileUtils.cd '/tmp' do
Yggdrasil.command %w{update} +
%w{-r 4 --username hoge --password foo --non-interactive}
end
`cat /tmp/yggdrasil-test/A`.should == "A:related/absolute path\n"
`cat /tmp/yggdrasil-test/B`.should == "B:related/absolute path\n"
end
end

0 comments on commit 43613ed

Please sign in to comment.