Added Piston::WorkingCopy#merge, #youngest and #repos. Made #log report moves.
git-svn-id: svn+ssh://rubyforge.org/var/svn/piston/trunk@133 d6c2ea82-c31b-0410-8381-e9c44f9824c5
| |   |
| 23 | 23 | @dir = dir |
| 24 | 24 | @path = Pathname.new(@dir).cleanpath |
| 25 | 25 | end |
| 26 | |
| 27 | def to_s |
| 28 | @path.to_s |
| 29 | end |
| 30 | |
| 31 | def repos |
| 32 | Piston::Repository.new(self.url, :logger => self.logger) |
| 33 | end |
| 26 | 34 | |
| 27 | 35 | def checkout(repos_url, revision="HEAD") |
| 28 | 36 | repos_url = is_a_url?(repos_url) |
| … | … | |
| 53 | 53 | def revision(force=false) |
| 54 | 54 | self.info(force)["Revision"] |
| 55 | 55 | end |
| 56 | alias_method :youngest, :revision |
| 56 | 57 | |
| 57 | 58 | def last_changed_revision(force=false) |
| 58 | 59 | self.info(force)["Last Changed Rev"] |
| … | … | |
| 123 | 123 | end |
| 124 | 124 | when "M" |
| 125 | 125 | changes[file] = :modify unless changes[file] |
| 126 | | when "D" |
| 127 | | changes[file] = :delete |
| 126 | when "D" |
| 127 | if [changes[file]].flatten.first == :copy then |
| 128 | changes[file][0] = :move |
| 129 | else |
| 130 | changes[file] = :delete |
| 131 | end |
| 128 | 132 | end |
| 129 | 133 | end |
| 130 | 134 | |
| … | … | |
| 168 | 168 | def delete(from) |
| 169 | 169 | svn :delete, wc_path(from) |
| 170 | 170 | end |
| 171 | |
| 172 | def merge(path, revisions) |
| 173 | revisions = "#{revisions.first}:#{revisions.last}" if revisions.respond_to?(:last) |
| 174 | svn(:merge, "--revision", revisions, wc_path(path), wc_path(path)) |
| 175 | end |
| 171 | 176 | |
| 172 | 177 | if RUBY_PLATFORM =~ /mswin32/ then |
| 173 | 178 | def wc_path(wcpath) |
| toggle raw diff |
--- a/lib/piston/working_copy.rb
+++ b/lib/piston/working_copy.rb
@@ -23,6 +23,14 @@ module Piston
@dir = dir
@path = Pathname.new(@dir).cleanpath
end
+
+ def to_s
+ @path.to_s
+ end
+
+ def repos
+ Piston::Repository.new(self.url, :logger => self.logger)
+ end
def checkout(repos_url, revision="HEAD")
repos_url = is_a_url?(repos_url)
@@ -45,6 +53,7 @@ module Piston
def revision(force=false)
self.info(force)["Revision"]
end
+ alias_method :youngest, :revision
def last_changed_revision(force=false)
self.info(force)["Last Changed Rev"]
@@ -114,8 +123,12 @@ module Piston
end
when "M"
changes[file] = :modify unless changes[file]
- when "D"
- changes[file] = :delete
+ when "D"
+ if [changes[file]].flatten.first == :copy then
+ changes[file][0] = :move
+ else
+ changes[file] = :delete
+ end
end
end
@@ -155,6 +168,11 @@ module Piston
def delete(from)
svn :delete, wc_path(from)
end
+
+ def merge(path, revisions)
+ revisions = "#{revisions.first}:#{revisions.last}" if revisions.respond_to?(:last)
+ svn(:merge, "--revision", revisions, wc_path(path), wc_path(path))
+ end
if RUBY_PLATFORM =~ /mswin32/ then
def wc_path(wcpath)
|