Patch #3917
closedFix for mercurial diff not working
0%
Description
Problem:
When reviewing file-level changes in Mercurial repositories, URLs of the form below fail with the error "The entry or revision was not found in the repository":
http://redmine.example.com/repositories/diff/myproj/myfile.php?rev=39
This link can be found when reviewing a revision, to the right of each revised file click on the word "diff" inside of parentheses.
The issue is caused because a badly formed shell command is being generated. What should be generated is /usr/bin/hg -R 'file:///path_to_myproj/' diff -r 38 -r 39 --nodates -I '/path_to_myproj/myfile.php'
What is actually generated is:/usr/bin/hg -R 'file:///path_to_myproj/' diff -r 38 -r 39 --nodates -I 'file:///path_to_myproj/myfile.php'
Fix:
In /lib/redmine/scm/adapters/mercurial_adapter.rb, replace this line:
cmd << " -I #{target(path)}" unless path.empty?
with:
unless path.empty?
filepath = target(path).sub(/file:\/\//, '')
cmd << " -I #{filepath}"
end
Related issues
Updated by Yuya Nishihara over 14 years ago
Dave Winzler wrote:
What is actually generated is:
/usr/bin/hg -R 'file:///path_to_myproj/' diff -r 38 -r 39 --nodates -I 'file:///path_to_myproj/myfile.php'
Did you configure the "Root directory" of your repo as "file:///path_to_myproj/" ?
It should be a directory path "/path_to_myproj/", not a URL.
If not, please provide Redmine version.
Updated by Dave Winzler over 14 years ago
Yuya, thanks for identifying the problem. Yes, I was using a file: URI rather than an absolute path. All works as it should now, thank you!
Updated by Toshi MARUYAMA over 13 years ago
- Status changed from New to Closed
This issue is duplicate with #6911. I close this issue.
"file://" is common issue of git and mercurial.