From 43613ed6aa1b38837e509b9d004be61380406649 Mon Sep 17 00:00:00 2001 From: tkusukawa Date: Sat, 10 Aug 2013 15:11:20 +0900 Subject: [PATCH] =?UTF-8?q?fixes=20#17=20update=E3=81=A7=E3=83=AA=E3=83=93?= =?UTF-8?q?=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=92=E6=8C=87=E5=AE=9A=E3=81=A7?= =?UTF-8?q?=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/yggdrasil.rb | 1 + lib/yggdrasil/diff.rb | 4 ++-- lib/yggdrasil/help.rb | 1 + lib/yggdrasil/update.rb | 1 + spec/help_spec.rb | 2 ++ spec/update_spec.rb | 16 ++++++++++++++++ 6 files changed, 23 insertions(+), 2 deletions(-) diff --git a/lib/yggdrasil.rb b/lib/yggdrasil.rb index 5d871f0..a7b6511 100644 --- a/lib/yggdrasil.rb +++ b/lib/yggdrasil.rb @@ -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" diff --git a/lib/yggdrasil/diff.rb b/lib/yggdrasil/diff.rb index d5fe5a8..83648e6 100644 --- a/lib/yggdrasil/diff.rb +++ b/lib/yggdrasil/diff.rb @@ -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 @@ -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) diff --git a/lib/yggdrasil/help.rb b/lib/yggdrasil/help.rb index bab92de..d9b13a8 100644 --- a/lib/yggdrasil/help.rb +++ b/lib/yggdrasil/help.rb @@ -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 diff --git a/lib/yggdrasil/update.rb b/lib/yggdrasil/update.rb index 1048630..873e271 100644 --- a/lib/yggdrasil/update.rb +++ b/lib/yggdrasil/update.rb @@ -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 diff --git a/spec/help_spec.rb b/spec/help_spec.rb index 101bb39..74fe738 100644 --- a/spec/help_spec.rb +++ b/spec/help_spec.rb @@ -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 @@ -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 diff --git a/spec/update_spec.rb b/spec/update_spec.rb index 628ec87..725e112 100644 --- a/spec/update_spec.rb +++ b/spec/update_spec.rb @@ -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