diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb index c0b879a91..04680f104 100644 --- a/lib/redmine/scm/adapters/mercurial_adapter.rb +++ b/lib/redmine/scm/adapters/mercurial_adapter.rb @@ -205,13 +205,8 @@ module Redmine end def annotate(path, identifier=nil) - path ||= '' - cmd = "#{self.class.sq_bin} -R #{target('')}" - cmd << " annotate -ncu" - cmd << " -r #{hgrev(identifier, true)}" - cmd << " #{target(path)}" blame = Annotate.new - shellout(cmd) do |io| + hg 'annotate', '-ncu', '-r', hgrev(identifier), hgtarget(path) do |io| io.each_line do |line| next unless line =~ %r{^([^:]+)\s(\d+)\s([0-9a-f]+):\s(.*)$} r = Revision.new(:author => $1.strip, :revision => $2, :scmid => $3, @@ -219,8 +214,9 @@ module Redmine blame.add_line($4.rstrip, r) end end - return nil if $? && $?.exitstatus != 0 blame + rescue HgCommandAborted + nil # means not found or cannot be annotated end class Revision < Redmine::Scm::Adapters::Revision