Skip to content

Commit

Permalink
scm: mercurial: switch shell quote revision with argument.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4828 e93f8b46-1217-0410-a6f0-8f06a7374b81
  • Loading branch information
marutosi committed Feb 15, 2011
1 parent 05f260d commit e3b3152
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/redmine/scm/adapters/mercurial_adapter.rb
Expand Up @@ -93,7 +93,7 @@ def entries(path=nil, identifier=nil)
path ||= ''
entries = Entries.new
cmd = "#{self.class.sq_bin} -R #{target('')} --cwd #{target('')} locate"
cmd << " -r #{hgrev(identifier)}"
cmd << " -r #{hgrev(identifier, true)}"
cmd << " " + shell_quote("path:#{path}") unless path.empty?
shellout(cmd) do |io|
io.each_line do |line|
Expand All @@ -120,9 +120,9 @@ def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
revisions = Revisions.new
cmd = "#{self.class.sq_bin} --debug --encoding utf8 -R #{target('')} log -C --style #{shell_quote self.class.template_path}"
if identifier_from && identifier_to
cmd << " -r #{hgrev(identifier_from)}:#{hgrev(identifier_to)}"
cmd << " -r #{hgrev(identifier_from, true)}:#{hgrev(identifier_to, true)}"
elsif identifier_from
cmd << " -r #{hgrev(identifier_from)}:"
cmd << " -r #{hgrev(identifier_from, true)}:"
end
cmd << " --limit #{options[:limit].to_i}" if options[:limit]
cmd << " #{shell_quote path}" unless path.blank?
Expand Down Expand Up @@ -168,10 +168,10 @@ def diff(path, identifier_from, identifier_to=nil)
diff_args = ''
diff = []
if identifier_to
diff_args = "-r #{hgrev(identifier_to)} -r #{hgrev(identifier_from)}"
diff_args = "-r #{hgrev(identifier_to, true)} -r #{hgrev(identifier_from, true)}"
else
if self.class.client_version_above?([1, 2])
diff_args = "-c #{hgrev(identifier_from)}"
diff_args = "-c #{hgrev(identifier_from, true)}"
else
return []
end
Expand All @@ -189,7 +189,7 @@ def diff(path, identifier_from, identifier_to=nil)

def cat(path, identifier=nil)
cmd = "#{self.class.sq_bin} -R #{target('')} cat"
cmd << " -r #{hgrev(identifier)}"
cmd << " -r #{hgrev(identifier, true)}"
cmd << " #{target(path)}"
cat = nil
shellout(cmd) do |io|
Expand All @@ -204,7 +204,7 @@ def annotate(path, identifier=nil)
path ||= ''
cmd = "#{self.class.sq_bin} -R #{target('')}"
cmd << " annotate -ncu"
cmd << " -r #{hgrev(identifier)}"
cmd << " -r #{hgrev(identifier, true)}"
cmd << " #{target(path)}"
blame = Annotate.new
shellout(cmd) do |io|
Expand All @@ -227,8 +227,10 @@ def format_identifier
end

# Returns correct revision identifier
def hgrev(identifier)
shell_quote(identifier.blank? ? 'tip' : identifier.to_s)
def hgrev(identifier, sq=false)
rev = identifier.blank? ? 'tip' : identifier.to_s
rev = shell_quote(rev) if sq
rev
end
private :hgrev
end
Expand Down

0 comments on commit e3b3152

Please sign in to comment.