public
Description: Piston is a utility that eases vendor branch management. This repository is a complete reimplementation of Piston to provide different backends, depending on the repositories and working copies you pistonize from.
Homepage: http://piston.rubyforge.org/
Clone URL: git://github.com/francois/piston.git
Search Repo:
Adding info in git repository.
tapajos (author)
Mon May 12 07:04:04 -0700 2008
commit  11eb751fd6ec64c39523a8f1c7465370929f8582
tree    2422c4257b4c4f9957662d90adb21ea70f1887ad
parent  e34929ceb852cbd3d6609d13cea7bf4b885defaa
...
13
14
15
 
16
17
18
...
13
14
15
16
17
18
19
0
@@ -13,6 +13,7 @@ lib/piston/commands.rb
0
 lib/piston/commands/base.rb
0
 lib/piston/commands/import.rb
0
 lib/piston/commands/lock_unlock.rb
0
+lib/piston/commands/info.rb
0
 lib/piston/git.rb
0
 lib/piston/git/client.rb
0
 lib/piston/git/commit.rb
...
161
162
163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
165
166
...
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
0
@@ -161,6 +161,32 @@ Main {
0
       end
0
     end
0
   end
0
+
0
+
0
+ mode "info" do
0
+ mixin :standard_options
0
+
0
+ argument "directory" do
0
+ argument_required
0
+ optional
0
+ description "Which directory to get info"
0
+ end
0
+
0
+ logger_level Logger::DEBUG
0
+ def run
0
+ configure_logging!
0
+
0
+ cmd = Piston::Commands::Info.new(:wcdir => params["directory"].value,
0
+ :verbose => params["verbose"].value,
0
+ :quiet => params["quiet"].value,
0
+ :force => params["force"].value)
0
+ begin
0
+ cmd.run(params["directory"].value)
0
+ rescue Piston::WorkingCopy::NotWorkingCopy
0
+ puts "The #{params["directory"].value} is not Pistonized"
0
+ end
0
+ end
0
+ end
0
 
0
   mode "update" do
0
     mixin :standard_options
...
1
2
3
 
 
...
1
2
 
3
4
0
@@ -1,3 +1,4 @@
0
 require "piston/commands/import"
0
 require "piston/commands/lock_unlock"
0
-require "piston/commands/update"
2
+# require "piston/commands/update"
0
+require "piston/commands/info"
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
@@ -0,0 +1,15 @@
0
+require "piston/commands/base"
0
+
0
+module Piston
0
+ module Commands
0
+ class Info < Piston::Commands::Base
0
+ attr_reader :options
0
+
0
+ def run(wcdir)
0
+ working_copy = Piston::WorkingCopy.guess(wcdir)
0
+ raise Piston::WorkingCopy::NotWorkingCopy if !working_copy.exist? || !working_copy.pistonized?
0
+ puts working_copy.info
0
+ end
0
+ end
0
+ end
0
+end
...
57
58
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
61
62
...
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
0
@@ -57,6 +57,22 @@ module Piston
0
       def finalize
0
         Dir.chdir(path) { git(:add, ".") }
0
       end
0
+
0
+ def info
0
+ values = recall
0
+ result = []
0
+ result << "+---------------------------Piston Info----------------------------------+"
0
+ result << "Directory: #{path}"
0
+ values["repository_class"] =~ /Piston::(.*)::Repository/
0
+ result << "Repository type: #{$1}"
0
+ result << "Repository: #{values["repository_url"]}"
0
+ result << "Commit: #{values["handler"]["commit"]}" if values["handler"]["commit"]
0
+ result << "Remote Revision: #{values["handler"]["piston:remote-revision"]}" if values["handler"]["piston:remote-revision"]
0
+ result << "Lock: #{values["lock"]}"
0
+ result << "+------------------------------------------------------------------------+"
0
+ result.join("\n")
0
+ end
0
+
0
     end
0
   end
0
 end
...
58
59
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
62
63
...
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
0
@@ -58,6 +58,22 @@ module Piston
0
           svn(:add, item)
0
         end
0
       end
0
+
0
+ def info
0
+ values = recall
0
+ result = []
0
+ result << "+---------------------------Piston Info----------------------------------+"
0
+ result << "Directory: #{path}"
0
+ result << "Repository type: SVN"
0
+ result << "Repository: #{values["repository_url"]}"
0
+ values
0
+ # result << "Commit: #{values["handler"]["commit"]}"
0
+ # result << "Lock: #{values["lock"]}"
0
+ # result << "+------------------------------------------------------------------------+"
0
+ # result.join("\n")
0
+ end
0
+
0
+
0
     end
0
   end
0
 end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
0
@@ -0,0 +1,46 @@
0
+require File.dirname(__FILE__) + "/../test_helper"
0
+
0
+class TestInfo < Test::Unit::TestCase
0
+ def setup
0
+ @values = {"lock" => false}
0
+ @wcdir = "tmp/wcdir"
0
+ @wc = mock("WorkingCopy")
0
+ end
0
+
0
+ def test_info
0
+ run_and_verify do
0
+ @wc.expects(:exist?).returns(true)
0
+ @wc.expects(:pistonized?).returns(true)
0
+ @wc.expects(:info)
0
+ end
0
+ end
0
+
0
+ def test_run_when_directory_not_exist
0
+ assert_raise(Piston::WorkingCopy::NotWorkingCopy) do
0
+ run_and_verify do
0
+ @wc.expects(:exist?).returns(false)
0
+ end
0
+ end
0
+ end
0
+
0
+ def test_run_when_directory_exist_but_yml_not_exit
0
+ assert_raise(Piston::WorkingCopy::NotWorkingCopy) do
0
+ run_and_verify do
0
+ @wc.expects(:exist?).returns(true)
0
+ @wc.expects(:pistonized?).returns(false)
0
+ end
0
+ end
0
+ end
0
+
0
+ private
0
+ def run_and_verify
0
+ yield
0
+ lock_unlock_command.run(@wcdir)
0
+ end
0
+
0
+ def lock_unlock_command
0
+ Piston::WorkingCopy.expects(:guess).with(@wcdir).returns(@wc)
0
+ Piston::Commands::Info.new(:verbose => "verbose",
0
+ :quiet => "quiet", :force => "force")
0
+ end
0
+end

Comments