Commit 5ec8d4d295efba114a8afa3c5cbe0dad50b5bbe2

Added Piston::Repository#destroy! and #last_changed_rev

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

Commit diff

lib/piston/repository.rb

 
2121 end
2222 end
2323
24 class NoDestroyOnRemoteRepositoryUrl < RepositoryError
25 def initialize(url)
26 super "URL #{url.inspect} is remote -- cannot destroy there"
27 end
28 end
29
2430 class FileNotFound < RepositoryError
2531 def initialize(url, revision)
2632 super "URL #{url.inspect} does not exist in revision #{revision}"
6868 def youngest
6969 self.info["Revision"].to_i
7070 end
71
72 def last_changed_rev
73 self.info["Last Changed Rev"].to_i
74 end
7175
7276 def uuid
7377 self.info["Repository UUID"]
9696 FileUtils.mkdir_p(repos_parent_dir)
9797 raise DirectoryAlreadyExists.new(self.local_path) if File.directory?(self.local_path)
9898
99 svnadmin :create, local_path
99 svnadmin :create, self.local_path
100100 self
101101 end
102
103 # Deletes the repository if it is a local one
104 def destroy!
105 raise NoDestroyOnRemoteRepositoryUrl.new(self.url) unless self.url =~ %r{\Afile://}
106 FileUtils.rm_rf(self.local_path)
107 self
108 end
102109 end
103110end
toggle raw diff