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:
Repository#at must now be able to instantiate a revision/commit using 
recalled values.
francois (author)
Thu Apr 17 10:39:57 -0700 2008
commit  95c4d49e376dfbccdf97608c6c19fafe092bb7a4
tree    cfc18341ac9ab4be61ef6f4310cb5c9b03649d3a
parent  7a1cadb6b18c86be4a5c798a4415c051bc255ca8
...
35
36
37
 
 
38
39
40
...
35
36
37
38
39
40
41
42
0
@@ -35,6 +35,8 @@
0
 
0
       def at(commit)
0
         case commit
0
+ when Hash
0
+ Piston::Git::Commit.new(self, commit[Piston::Git::COMMIT])
0
         when :head
0
           Piston::Git::Commit.new(self, "HEAD")
0
         else
...
36
37
38
39
40
 
 
 
 
 
41
42
43
44
45
46
 
 
 
 
 
 
47
48
49
...
36
37
38
 
 
39
40
41
42
43
44
 
 
 
 
 
45
46
47
48
49
50
51
52
53
0
@@ -36,14 +36,18 @@
0
       end
0
 
0
       def at(revision)
0
- rev = case
0
- when revision == :head
0
+ if revision.respond_to?(:keys) then
0
+ rev = revision[Piston::Svn::REMOTE_REV]
0
+ else
0
+ rev = case
0
+ when revision == :head
0
                 "HEAD"
0
- when revision.to_i != 0
0
- revision.to_i
0
- else
0
- raise ArgumentError, "Invalid revision argument: #{revision.inspect}"
0
- end
0
+ when revision.to_i != 0
0
+ revision.to_i
0
+ else
0
+ raise ArgumentError, "Invalid revision argument: #{revision.inspect}"
0
+ end
0
+ end
0
 
0
         Piston::Svn::Revision.new(self, rev)
0
       end
...
14
15
16
 
 
 
 
 
17
...
14
15
16
17
18
19
20
21
22
0
@@ -14,5 +14,10 @@
0
     Piston::Git::Commit.expects(:new).with(@repos, "HEAD").returns(commit = mock("commit"))
0
     assert_equal commit, @repos.at(:head)
0
   end
0
+
0
+ def test_returns_a_git_commit_using_recalled_values
0
+ Piston::Git::Commit.expects(:new).with(@repos, "a"*40).returns(commit = mock("commit"))
0
+ assert_equal commit, @repos.at(Piston::Git::COMMIT => "a"*40)
0
+ end
0
 end
...
9
10
11
 
 
 
 
 
 
12
...
9
10
11
12
13
14
15
16
17
18
0
@@ -9,5 +9,11 @@
0
     Piston::Svn::Revision.expects(:new).with(@repos, "HEAD").returns(:newrev)
0
     assert_equal :newrev, @repos.at(:head)
0
   end
0
+
0
+ def test_instantiate_revision_using_recalled_values
0
+ Piston::Svn::Revision.expects(:new).with(@repos, 9123).returns(:newrev)
0
+ assert_equal :newrev, @repos.at(Piston::Svn::REMOTE_REV => 9123,
0
+ Piston::Svn::UUID => "5ecf4fe2-1ee6-0310-87b1-e25e094e27de")
0
+ end
0
 end

Comments

    No one has commented yet.