Project

General

Profile

Actions

Patch #3917

closed

Fix for mercurial diff not working

Added by Dave Winzler over 14 years ago. Updated about 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Toshi MARUYAMA
Category:
SCM
Target version:
-
Start date:
2009-09-24
Due date:
% Done:

0%

Estimated time:

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

Is duplicate of Redmine - Defect #6911: Viewing files or diff with mercurial gives an errorClosed2010-11-16

Actions
Actions #1

Updated by Yuya Nishihara almost 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.

Actions #2

Updated by Dave Winzler almost 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!

Actions #3

Updated by Toshi MARUYAMA about 13 years ago

  • Category set to SCM
Actions #4

Updated by Toshi MARUYAMA about 13 years ago

  • Assignee set to Toshi MARUYAMA
Actions #5

Updated by Toshi MARUYAMA about 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.

Actions

Also available in: Atom PDF