From 7d7c67dabad1ad7d50bade26a0f6316e13868ea6 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 18 Dec 2010 18:12:12 +0000 Subject: 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 --- lib/redmine/scm/adapters/mercurial_adapter.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/redmine/scm/adapters/mercurial_adapter.rb') 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 -- cgit v1.2.3