Defect #27043 ยป 0001-Fix-broken-links-to-files-on-the-revision-page-when-.patch
| app/models/repository/subversion.rb | ||
|---|---|---|
|
# url = file:///var/svn/foo/bar
|
||
|
# => returns /bar
|
||
|
def relative_url
|
||
|
@relative_url ||= url.gsub(Regexp.new("^#{Regexp.escape(root_url || scm.root_url)}", Regexp::IGNORECASE), '')
|
||
|
@relative_url ||= begin
|
||
|
# root_url is the repository root reported by "svn info", which is
|
||
|
# percent-encoded (e.g. file:///var/svn/foo%20bar)
|
||
|
root = Addressable::URI.unencode((root_url || scm.root_url).to_s)
|
||
|
url.gsub(Regexp.new("^#{Regexp.escape(root)}", Regexp::IGNORECASE), '')
|
||
|
end
|
||
|
end
|
||
|
end
|
||
| test/unit/repository_subversion_test.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
def test_relative_path_should_handle_percent_encoded_root_url
|
||
|
repository =
|
||
|
Repository::Subversion.new(
|
||
|
:project => @project,
|
||
|
:url => 'file:///svn/repo with spaces/trunk',
|
||
|
:root_url => 'file:///svn/repo%20with%20spaces'
|
||
|
)
|
||
|
assert_equal '/dir/file.txt', repository.relative_path('/trunk/dir/file.txt')
|
||
|
end
|
||
|
if repository_configured?('subversion')
|
||
|
def test_fetch_changesets_from_scratch
|
||
|
assert_equal 0, @repository.changesets.count
|
||