@@ -74,10 +74,10 module Redmine | |||||
74 |
|
74 | |||
75 | def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={}) |
|
75 | def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={}) | |
76 | path ||= '' |
|
76 | path ||= '' | |
77 |
identifier_from = |
|
77 | identifier_from = (identifier_from and identifier_from.to_i > 0) ? identifier_from.to_i : 'last:1' | |
78 |
identifier_to = |
|
78 | identifier_to = (identifier_to and identifier_to.to_i > 0) ? identifier_to.to_i : 1 | |
79 | revisions = Revisions.new |
|
79 | revisions = Revisions.new | |
80 |
cmd = "#{BZR_BIN} log -v --show-ids -r#{identifier_to |
|
80 | cmd = "#{BZR_BIN} log -v --show-ids -r#{identifier_to}..#{identifier_from} #{target(path)}" | |
81 | shellout(cmd) do |io| |
|
81 | shellout(cmd) do |io| | |
82 | revision = nil |
|
82 | revision = nil | |
83 | parsing = nil |
|
83 | parsing = nil | |
@@ -140,6 +140,9 module Redmine | |||||
140 | else |
|
140 | else | |
141 | identifier_to = identifier_from.to_i - 1 |
|
141 | identifier_to = identifier_from.to_i - 1 | |
142 | end |
|
142 | end | |
|
143 | if identifier_from | |||
|
144 | identifier_from = identifier_from.to_i | |||
|
145 | end | |||
143 | cmd = "#{BZR_BIN} diff -r#{identifier_to}..#{identifier_from} #{target(path)}" |
|
146 | cmd = "#{BZR_BIN} diff -r#{identifier_to}..#{identifier_from} #{target(path)}" | |
144 | diff = [] |
|
147 | diff = [] | |
145 | shellout(cmd) do |io| |
|
148 | shellout(cmd) do |io| |
@@ -63,7 +63,7 module Redmine | |||||
63 | logger.debug "<cvs> entries '#{path}' with identifier '#{identifier}'" |
|
63 | logger.debug "<cvs> entries '#{path}' with identifier '#{identifier}'" | |
64 | path_with_project="#{url}#{with_leading_slash(path)}" |
|
64 | path_with_project="#{url}#{with_leading_slash(path)}" | |
65 | entries = Entries.new |
|
65 | entries = Entries.new | |
66 | cmd = "#{CVS_BIN} -d #{root_url} rls -e" |
|
66 | cmd = "#{CVS_BIN} -d #{shell_quote root_url} rls -e" | |
67 | cmd << " -D \"#{time_to_cvstime(identifier)}\"" if identifier |
|
67 | cmd << " -D \"#{time_to_cvstime(identifier)}\"" if identifier | |
68 | cmd << " #{shell_quote path_with_project}" |
|
68 | cmd << " #{shell_quote path_with_project}" | |
69 | shellout(cmd) do |io| |
|
69 | shellout(cmd) do |io| | |
@@ -108,7 +108,7 module Redmine | |||||
108 | logger.debug "<cvs> revisions path:'#{path}',identifier_from #{identifier_from}, identifier_to #{identifier_to}" |
|
108 | logger.debug "<cvs> revisions path:'#{path}',identifier_from #{identifier_from}, identifier_to #{identifier_to}" | |
109 |
|
109 | |||
110 | path_with_project="#{url}#{with_leading_slash(path)}" |
|
110 | path_with_project="#{url}#{with_leading_slash(path)}" | |
111 | cmd = "#{CVS_BIN} -d #{root_url} rlog" |
|
111 | cmd = "#{CVS_BIN} -d #{shell_quote root_url} rlog" | |
112 | cmd << " -d\">#{time_to_cvstime(identifier_from)}\"" if identifier_from |
|
112 | cmd << " -d\">#{time_to_cvstime(identifier_from)}\"" if identifier_from | |
113 | cmd << " #{shell_quote path_with_project}" |
|
113 | cmd << " #{shell_quote path_with_project}" | |
114 | shellout(cmd) do |io| |
|
114 | shellout(cmd) do |io| | |
@@ -229,7 +229,7 module Redmine | |||||
229 | def diff(path, identifier_from, identifier_to=nil) |
|
229 | def diff(path, identifier_from, identifier_to=nil) | |
230 | logger.debug "<cvs> diff path:'#{path}',identifier_from #{identifier_from}, identifier_to #{identifier_to}" |
|
230 | logger.debug "<cvs> diff path:'#{path}',identifier_from #{identifier_from}, identifier_to #{identifier_to}" | |
231 | path_with_project="#{url}#{with_leading_slash(path)}" |
|
231 | path_with_project="#{url}#{with_leading_slash(path)}" | |
232 | cmd = "#{CVS_BIN} -d #{root_url} rdiff -u -r#{identifier_to} -r#{identifier_from} #{shell_quote path_with_project}" |
|
232 | cmd = "#{CVS_BIN} -d #{shell_quote root_url} rdiff -u -r#{identifier_to.to_i} -r#{identifier_from.to_i} #{shell_quote path_with_project}" | |
233 | diff = [] |
|
233 | diff = [] | |
234 | shellout(cmd) do |io| |
|
234 | shellout(cmd) do |io| | |
235 | io.each_line do |line| |
|
235 | io.each_line do |line| | |
@@ -244,7 +244,7 module Redmine | |||||
244 | identifier = (identifier) ? identifier : "HEAD" |
|
244 | identifier = (identifier) ? identifier : "HEAD" | |
245 | logger.debug "<cvs> cat path:'#{path}',identifier #{identifier}" |
|
245 | logger.debug "<cvs> cat path:'#{path}',identifier #{identifier}" | |
246 | path_with_project="#{url}#{with_leading_slash(path)}" |
|
246 | path_with_project="#{url}#{with_leading_slash(path)}" | |
247 | cmd = "#{CVS_BIN} -d #{root_url} co" |
|
247 | cmd = "#{CVS_BIN} -d #{shell_quote root_url} co" | |
248 | cmd << " -D \"#{time_to_cvstime(identifier)}\"" if identifier |
|
248 | cmd << " -D \"#{time_to_cvstime(identifier)}\"" if identifier | |
249 | cmd << " -p #{shell_quote path_with_project}" |
|
249 | cmd << " -p #{shell_quote path_with_project}" | |
250 | cat = nil |
|
250 | cat = nil | |
@@ -256,10 +256,10 module Redmine | |||||
256 | end |
|
256 | end | |
257 |
|
257 | |||
258 | def annotate(path, identifier=nil) |
|
258 | def annotate(path, identifier=nil) | |
259 | identifier = (identifier) ? identifier : "HEAD" |
|
259 | identifier = (identifier) ? identifier.to_i : "HEAD" | |
260 | logger.debug "<cvs> annotate path:'#{path}',identifier #{identifier}" |
|
260 | logger.debug "<cvs> annotate path:'#{path}',identifier #{identifier}" | |
261 | path_with_project="#{url}#{with_leading_slash(path)}" |
|
261 | path_with_project="#{url}#{with_leading_slash(path)}" | |
262 | cmd = "#{CVS_BIN} -d #{root_url} rannotate -r#{identifier} #{shell_quote path_with_project}" |
|
262 | cmd = "#{CVS_BIN} -d #{shell_quote root_url} rannotate -r#{identifier} #{shell_quote path_with_project}" | |
263 | blame = Annotate.new |
|
263 | blame = Annotate.new | |
264 | shellout(cmd) do |io| |
|
264 | shellout(cmd) do |io| | |
265 | io.each_line do |line| |
|
265 | io.each_line do |line| |
@@ -66,7 +66,7 module Redmine | |||||
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| | |
@@ -90,7 +90,7 module Redmine | |||||
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| | |
@@ -116,7 +116,7 module Redmine | |||||
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 | |
@@ -135,7 +135,7 module Redmine | |||||
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 | |
@@ -170,7 +170,7 module Redmine | |||||
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| |
@@ -117,7 +117,7 module Redmine | |||||
117 | cmd = "#{GIT_BIN} --git-dir #{target('')} log --no-color --raw --date=iso --pretty=fuller " |
|
117 | cmd = "#{GIT_BIN} --git-dir #{target('')} log --no-color --raw --date=iso --pretty=fuller " | |
118 | cmd << " --reverse " if options[:reverse] |
|
118 | cmd << " --reverse " if options[:reverse] | |
119 | cmd << " --all " if options[:all] |
|
119 | cmd << " --all " if options[:all] | |
120 | cmd << " -n #{options[:limit]} " if options[:limit] |
|
120 | cmd << " -n #{options[:limit].to_i} " if options[:limit] | |
121 | cmd << "#{shell_quote(identifier_from + '..')}" if identifier_from |
|
121 | cmd << "#{shell_quote(identifier_from + '..')}" if identifier_from | |
122 | cmd << "#{shell_quote identifier_to}" if identifier_to |
|
122 | cmd << "#{shell_quote identifier_to}" if identifier_to | |
123 | cmd << " --since=#{shell_quote(options[:since].strftime("%Y-%m-%d %H:%M:%S"))}" if options[:since] |
|
123 | cmd << " --since=#{shell_quote(options[:since].strftime("%Y-%m-%d %H:%M:%S"))}" if options[:since] |
@@ -80,7 +80,7 module Redmine | |||||
80 | path ||= '' |
|
80 | path ||= '' | |
81 | entries = Entries.new |
|
81 | entries = Entries.new | |
82 | cmd = "#{HG_BIN} -R #{target('')} --cwd #{target('')} locate" |
|
82 | cmd = "#{HG_BIN} -R #{target('')} --cwd #{target('')} locate" | |
83 | cmd << " -r " + (identifier ? identifier.to_s : "tip") |
|
83 | cmd << " -r " + shell_quote(identifier ? identifier.to_s : "tip") | |
84 | cmd << " " + shell_quote("path:#{path}") unless path.empty? |
|
84 | cmd << " " + shell_quote("path:#{path}") unless path.empty? | |
85 | shellout(cmd) do |io| |
|
85 | shellout(cmd) do |io| | |
86 | io.each_line do |line| |
|
86 | io.each_line do |line| | |
@@ -112,7 +112,7 module Redmine | |||||
112 | cmd << " -r #{identifier_from.to_i}:" |
|
112 | cmd << " -r #{identifier_from.to_i}:" | |
113 | end |
|
113 | end | |
114 | cmd << " --limit #{options[:limit].to_i}" if options[:limit] |
|
114 | cmd << " --limit #{options[:limit].to_i}" if options[:limit] | |
115 | cmd << " #{path}" if path |
|
115 | cmd << " #{shell_quote path}" if path | |
116 | shellout(cmd) do |io| |
|
116 | shellout(cmd) do |io| | |
117 | begin |
|
117 | begin | |
118 | # HG doesn't close the XML Document... |
|
118 | # HG doesn't close the XML Document... | |
@@ -157,6 +157,9 module Redmine | |||||
157 | else |
|
157 | else | |
158 | identifier_to = identifier_from.to_i - 1 |
|
158 | identifier_to = identifier_from.to_i - 1 | |
159 | end |
|
159 | end | |
|
160 | if identifier_from | |||
|
161 | identifier_from = identifier_from.to_i | |||
|
162 | end | |||
160 | cmd = "#{HG_BIN} -R #{target('')} diff -r #{identifier_to} -r #{identifier_from} --nodates" |
|
163 | cmd = "#{HG_BIN} -R #{target('')} diff -r #{identifier_to} -r #{identifier_from} --nodates" | |
161 | cmd << " -I #{target(path)}" unless path.empty? |
|
164 | cmd << " -I #{target(path)}" unless path.empty? | |
162 | diff = [] |
|
165 | diff = [] | |
@@ -171,7 +174,7 module Redmine | |||||
171 |
|
174 | |||
172 | def cat(path, identifier=nil) |
|
175 | def cat(path, identifier=nil) | |
173 | cmd = "#{HG_BIN} -R #{target('')} cat" |
|
176 | cmd = "#{HG_BIN} -R #{target('')} cat" | |
174 | cmd << " -r " + (identifier ? identifier.to_s : "tip") |
|
177 | cmd << " -r " + shell_quote(identifier ? identifier.to_s : "tip") | |
175 | cmd << " #{target(path)}" |
|
178 | cmd << " #{target(path)}" | |
176 | cat = nil |
|
179 | cat = nil | |
177 | shellout(cmd) do |io| |
|
180 | shellout(cmd) do |io| | |
@@ -186,7 +189,7 module Redmine | |||||
186 | path ||= '' |
|
189 | path ||= '' | |
187 | cmd = "#{HG_BIN} -R #{target('')}" |
|
190 | cmd = "#{HG_BIN} -R #{target('')}" | |
188 | cmd << " annotate -n -u" |
|
191 | cmd << " annotate -n -u" | |
189 | cmd << " -r " + (identifier ? identifier.to_s : "tip") |
|
192 | cmd << " -r " + shell_quote(identifier ? identifier.to_s : "tip") | |
190 | cmd << " -r #{identifier.to_i}" if identifier |
|
193 | cmd << " -r #{identifier.to_i}" if identifier | |
191 | cmd << " #{target(path)}" |
|
194 | cmd << " #{target(path)}" | |
192 | blame = Annotate.new |
|
195 | blame = Annotate.new |
@@ -135,8 +135,8 module Redmine | |||||
135 |
|
135 | |||
136 | def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={}) |
|
136 | def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={}) | |
137 | path ||= '' |
|
137 | path ||= '' | |
138 |
identifier_from = (identifier_from |
|
138 | identifier_from = (identifier_from && identifier_from.to_i > 0) ? identifier_from.to_i : "HEAD" | |
139 |
identifier_to = (identifier_to |
|
139 | identifier_to = (identifier_to && identifier_to.to_i > 0) ? identifier_to.to_i : 1 | |
140 | revisions = Revisions.new |
|
140 | revisions = Revisions.new | |
141 | cmd = "#{SVN_BIN} log --xml -r #{identifier_from}:#{identifier_to}" |
|
141 | cmd = "#{SVN_BIN} log --xml -r #{identifier_from}:#{identifier_to}" | |
142 | cmd << credentials_string |
|
142 | cmd << credentials_string |
General Comments 0
You need to be logged in to leave comments.
Login now