Project

General

Profile

Actions

Patch #3917

closed

Fix for mercurial diff not working

Added by Dave Winzler about 15 years ago. Updated almost 14 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

Also available in: Atom PDF