scm: mercurial: diff '-c' option supports above Mercurial 1.2 (#3724, #7253).

r4662 fails in old Mercurial.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4686 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA
2011-01-11 05:15:56 +00:00
parent 35b9972c81
commit a6f05b5e56
3 changed files with 28 additions and 14 deletions
@@ -154,14 +154,18 @@ module Redmine
def diff(path, identifier_from, identifier_to=nil)
path ||= ''
diff_args = ''
diff = []
if identifier_to
diff_args = "-r #{hgrev(identifier_to)} -r #{hgrev(identifier_from)}"
else
diff_args = "-c #{hgrev(identifier_from)}"
if self.class.client_version_above?([1, 2])
diff_args = "-c #{hgrev(identifier_from)}"
else
return []
end
end
cmd = "#{HG_BIN} -R #{target('')} diff --nodates --git #{diff_args}"
cmd << " -I #{target(path)}" unless path.empty?
diff = []
shellout(cmd) do |io|
io.each_line do |line|
diff << line