Mercurial > hg > soundsoftware-site
comparison lib/redmine/scm/adapters/darcs_adapter.rb @ 117:af80e5618e9b redmine-1.1
* Update to Redmine 1.1-stable branch (Redmine SVN rev 4707)
author | Chris Cannam |
---|---|
date | Thu, 13 Jan 2011 12:53:21 +0000 |
parents | 513646585e45 |
children | 0579821a129a |
comparison
equal
deleted
inserted
replaced
39:150ceac17a8d | 117:af80e5618e9b |
---|---|
64 # or nil if the given path doesn't exist in the repository | 64 # or nil if the given path doesn't exist in the repository |
65 def entries(path=nil, identifier=nil) | 65 def entries(path=nil, identifier=nil) |
66 path_prefix = (path.blank? ? '' : "#{path}/") | 66 path_prefix = (path.blank? ? '' : "#{path}/") |
67 path = '.' if path.blank? | 67 path = '.' if path.blank? |
68 entries = Entries.new | 68 entries = Entries.new |
69 cmd = "#{DARCS_BIN} annotate --repodir #{@url} --xml-output" | 69 cmd = "#{DARCS_BIN} annotate --repodir #{shell_quote @url} --xml-output" |
70 cmd << " --match #{shell_quote("hash #{identifier}")}" if identifier | 70 cmd << " --match #{shell_quote("hash #{identifier}")}" if identifier |
71 cmd << " #{shell_quote path}" | 71 cmd << " #{shell_quote path}" |
72 shellout(cmd) do |io| | 72 shellout(cmd) do |io| |
73 begin | 73 begin |
74 doc = REXML::Document.new(io) | 74 doc = REXML::Document.new(io) |
88 end | 88 end |
89 | 89 |
90 def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={}) | 90 def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={}) |
91 path = '.' if path.blank? | 91 path = '.' if path.blank? |
92 revisions = Revisions.new | 92 revisions = Revisions.new |
93 cmd = "#{DARCS_BIN} changes --repodir #{@url} --xml-output" | 93 cmd = "#{DARCS_BIN} changes --repodir #{shell_quote @url} --xml-output" |
94 cmd << " --from-match #{shell_quote("hash #{identifier_from}")}" if identifier_from | 94 cmd << " --from-match #{shell_quote("hash #{identifier_from}")}" if identifier_from |
95 cmd << " --last #{options[:limit].to_i}" if options[:limit] | 95 cmd << " --last #{options[:limit].to_i}" if options[:limit] |
96 shellout(cmd) do |io| | 96 shellout(cmd) do |io| |
97 begin | 97 begin |
98 doc = REXML::Document.new(io) | 98 doc = REXML::Document.new(io) |
114 revisions | 114 revisions |
115 end | 115 end |
116 | 116 |
117 def diff(path, identifier_from, identifier_to=nil) | 117 def diff(path, identifier_from, identifier_to=nil) |
118 path = '*' if path.blank? | 118 path = '*' if path.blank? |
119 cmd = "#{DARCS_BIN} diff --repodir #{@url}" | 119 cmd = "#{DARCS_BIN} diff --repodir #{shell_quote @url}" |
120 if identifier_to.nil? | 120 if identifier_to.nil? |
121 cmd << " --match #{shell_quote("hash #{identifier_from}")}" | 121 cmd << " --match #{shell_quote("hash #{identifier_from}")}" |
122 else | 122 else |
123 cmd << " --to-match #{shell_quote("hash #{identifier_from}")}" | 123 cmd << " --to-match #{shell_quote("hash #{identifier_from}")}" |
124 cmd << " --from-match #{shell_quote("hash #{identifier_to}")}" | 124 cmd << " --from-match #{shell_quote("hash #{identifier_to}")}" |
133 return nil if $? && $?.exitstatus != 0 | 133 return nil if $? && $?.exitstatus != 0 |
134 diff | 134 diff |
135 end | 135 end |
136 | 136 |
137 def cat(path, identifier=nil) | 137 def cat(path, identifier=nil) |
138 cmd = "#{DARCS_BIN} show content --repodir #{@url}" | 138 cmd = "#{DARCS_BIN} show content --repodir #{shell_quote @url}" |
139 cmd << " --match #{shell_quote("hash #{identifier}")}" if identifier | 139 cmd << " --match #{shell_quote("hash #{identifier}")}" if identifier |
140 cmd << " #{shell_quote path}" | 140 cmd << " #{shell_quote path}" |
141 cat = nil | 141 cat = nil |
142 shellout(cmd) do |io| | 142 shellout(cmd) do |io| |
143 io.binmode | 143 io.binmode |
168 }) | 168 }) |
169 end | 169 end |
170 | 170 |
171 # Retrieve changed paths for a single patch | 171 # Retrieve changed paths for a single patch |
172 def get_paths_for_patch(hash) | 172 def get_paths_for_patch(hash) |
173 cmd = "#{DARCS_BIN} annotate --repodir #{@url} --summary --xml-output" | 173 cmd = "#{DARCS_BIN} annotate --repodir #{shell_quote @url} --summary --xml-output" |
174 cmd << " --match #{shell_quote("hash #{hash}")} " | 174 cmd << " --match #{shell_quote("hash #{hash}")} " |
175 paths = [] | 175 paths = [] |
176 shellout(cmd) do |io| | 176 shellout(cmd) do |io| |
177 begin | 177 begin |
178 # Darcs xml output has multiple root elements in this case (tested with darcs 1.0.7) | 178 # Darcs xml output has multiple root elements in this case (tested with darcs 1.0.7) |