summaryrefslogtreecommitdiffstats
path: root/lib/redmine/scm/adapters/mercurial_adapter.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2010-12-18 18:12:12 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2010-12-18 18:12:12 +0000
commit7d7c67dabad1ad7d50bade26a0f6316e13868ea6 (patch)
treec000056368f505796002b151cb8ccaa5605f025e /lib/redmine/scm/adapters/mercurial_adapter.rb
parenta7595ec19154427bf38812208ac8443c2dca5462 (diff)
downloadredmine-7d7c67dabad1ad7d50bade26a0f6316e13868ea6.tar.gz
redmine-7d7c67dabad1ad7d50bade26a0f6316e13868ea6.zip
Fixed that some arguments where not properly escaped in scm adapters.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4539 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/scm/adapters/mercurial_adapter.rb')
-rw-r--r--lib/redmine/scm/adapters/mercurial_adapter.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb
index b47650190..7ee3333d8 100644
--- a/lib/redmine/scm/adapters/mercurial_adapter.rb
+++ b/lib/redmine/scm/adapters/mercurial_adapter.rb
@@ -80,7 +80,7 @@ module Redmine
path ||= ''
entries = Entries.new
cmd = "#{HG_BIN} -R #{target('')} --cwd #{target('')} locate"
- cmd << " -r " + (identifier ? identifier.to_s : "tip")
+ cmd << " -r " + shell_quote(identifier ? identifier.to_s : "tip")
cmd << " " + shell_quote("path:#{path}") unless path.empty?
shellout(cmd) do |io|
io.each_line do |line|
@@ -112,7 +112,7 @@ module Redmine
cmd << " -r #{identifier_from.to_i}:"
end
cmd << " --limit #{options[:limit].to_i}" if options[:limit]
- cmd << " #{path}" if path
+ cmd << " #{shell_quote path}" if path
shellout(cmd) do |io|
begin
# HG doesn't close the XML Document...
@@ -157,6 +157,9 @@ module Redmine
else
identifier_to = identifier_from.to_i - 1
end
+ if identifier_from
+ identifier_from = identifier_from.to_i
+ end
cmd = "#{HG_BIN} -R #{target('')} diff -r #{identifier_to} -r #{identifier_from} --nodates"
cmd << " -I #{target(path)}" unless path.empty?
diff = []
@@ -171,7 +174,7 @@ module Redmine
def cat(path, identifier=nil)
cmd = "#{HG_BIN} -R #{target('')} cat"
- cmd << " -r " + (identifier ? identifier.to_s : "tip")
+ cmd << " -r " + shell_quote(identifier ? identifier.to_s : "tip")
cmd << " #{target(path)}"
cat = nil
shellout(cmd) do |io|
@@ -186,7 +189,7 @@ module Redmine
path ||= ''
cmd = "#{HG_BIN} -R #{target('')}"
cmd << " annotate -n -u"
- cmd << " -r " + (identifier ? identifier.to_s : "tip")
+ cmd << " -r " + shell_quote(identifier ? identifier.to_s : "tip")
cmd << " -r #{identifier.to_i}" if identifier
cmd << " #{target(path)}"
blame = Annotate.new