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:
Implemented Piston::WorkingCopy#validate! to raise an exception unless 
everything is OK.
francois (author)
Tue May 13 15:49:26 -0700 2008
commit  6abfef22b5f739453f64e0db3dac0ee024000c0a
tree    c2c9f5e9940cbae820520eb8a65ae1fb254e117b
parent  a2ef04d7498a9f3dd83cc4ee22b14eeb218f9881
...
7
8
9
10
 
11
12
13
...
7
8
9
 
10
11
12
13
0
@@ -7,7 +7,7 @@
0
 
0
       def run(wcdir)
0
         working_copy = guess_wc(wcdir)
0
- raise Piston::WorkingCopy::NotWorkingCopy if !working_copy.exist? || !working_copy.pistonized?
0
+ working_copy.validate!
0
         working_copy.info.to_yaml
0
       end
0
     end
...
7
8
9
10
 
11
12
13
...
7
8
9
 
10
11
12
13
0
@@ -7,7 +7,7 @@
0
 
0
       def run(wcdir, lock)
0
         working_copy = guess_wc(wcdir)
0
- raise Piston::WorkingCopy::NotWorkingCopy if !working_copy.exist? || !working_copy.pistonized?
0
+ working_copy.validate!
0
 
0
         values = working_copy.recall
0
         values["lock"] = lock
...
7
8
9
 
10
11
12
...
7
8
9
10
11
12
13
0
@@ -7,6 +7,7 @@
0
       # +to+ is the new target revision we want to be at after update returns.
0
       def run(wcdir, to)
0
         working_copy = guess_wc(wcdir)
0
+ working_copy.validate!
0
 
0
         logger.debug {"Recalling previously saved values"}
0
         values = working_copy.recall
...
54
55
56
 
 
 
 
57
58
59
...
54
55
56
57
58
59
60
61
62
63
0
@@ -54,6 +54,10 @@
0
       yaml_path.exist? && yaml_path.file?
0
     end
0
 
0
+ def validate!
0
+ raise NotWorkingCopy unless self.exist? && self.pistonized?
0
+ end
0
+
0
     # Creates the initial working copy for pistonizing a new repository.
0
     def create
0
       logger.debug {"Creating working copy at #{path}"}
...
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
...
5
6
7
8
9
10
11
12
 
 
13
14
15
16
 
17
18
19
 
 
 
 
 
 
 
 
 
 
20
21
22
23
0
@@ -5,29 +5,19 @@
0
     @values = {"lock" => false}
0
     @wcdir = "tmp/wcdir"
0
     @wc = mock("WorkingCopy")
0
+ @wc.stubs(:validate!)
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
+ def test_validates_working_copy_before_working
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
+ @wc.expects(:validate!).raises(Piston::WorkingCopy::NotWorkingCopy)
0
       end
0
     end
0
   end
...
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
...
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
0
@@ -5,12 +5,11 @@
0
     @values = {"lock" => false}
0
     @wcdir = "tmp/wcdir"
0
     @wc = mock("WorkingCopy")
0
+ @wc.stubs(:validate!)
0
   end
0
-
0
+
0
   def test_lock_working_copy
0
     run_and_verify(true) do
0
- @wc.expects(:exist?).returns(true)
0
- @wc.expects(:pistonized?).returns(true)
0
       @wc.expects(:recall).returns(@values)
0
       @wc.expects(:finalize).returns(@values)
0
       @wc.expects(:remember).with(@values.merge("lock" => true), @values["handler"]).returns(@values)
0
0
0
@@ -19,27 +18,16 @@
0
 
0
   def test_unlock_working_copy
0
     run_and_verify(false) do
0
- @wc.expects(:exist?).returns(true)
0
- @wc.expects(:pistonized?).returns(true)
0
       @wc.expects(:recall).returns(@values)
0
       @wc.expects(:finalize).returns(@values)
0
       @wc.expects(:remember).with(@values.merge("lock" => false), @values["handler"]).returns(@values)
0
     end
0
   end
0
-
0
- def test_run_when_directory_not_exist
0
+
0
+ def test_validates_working_copy_before_working
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
+ @wc.expects(:validate!).raises(Piston::WorkingCopy::NotWorkingCopy)
0
       end
0
     end
0
   end

Comments

    No one has commented yet.