Commit 5474e0e5f0186971be9129d8708d449128df7d38

WorkingCopy#propget returns a #to_i version of the value, or nil, depending on circumstances.

git-svn-id: svn+ssh://rubyforge.org/var/svn/piston/trunk@123 d6c2ea82-c31b-0410-8381-e9c44f9824c5

Commit diff

lib/piston/working_copy.rb

 
5151 end
5252
5353 def propget(propname, target=self.dir)
54 svn(:propget, propname, wc_path(target)).chomp
54 value = svn(:propget, propname, wc_path(target)).chomp
55 return nil if value.empty?
56 value.to_i.to_s == value ? value.to_i : value
5557 end
5658
5759 alias_method :[], :propget
toggle raw diff

spec/working_copy_spec.rb

 
102102 @wc["piston:temp"] = "new value"
103103 @wc.propget("piston:temp").should == "new value"
104104 end
105
106 it "should return a Fixnum when the property value is an Integer" do
107 @wc.propset "piston:some-property", 24
108 @wc.propget("piston:some-property").should == 24
109 end
110
111 it "should return nil when the property doesn't exist" do
112 @wc.propget("piston:some-property").should be_nil
113 end
105114end
106115
107116describe Piston::WorkingCopy, "against a repository with 1 revision" do
toggle raw diff