Trac with Subversion 缺少 Browse Source 按钮

Trac with Subversion missing Browse Source button

我正在尝试在 Debian 9.7 stretch 上使用 Trac 配置 Subversion。 Trac 版本 1.2,svn 1.9.5。 Python 2.7。 svn 存储库的路径是 /var/svn/iec61850,trac 环境的路径是 /var/trac/iec61850。问题是浏览源按钮不存在。我怎么解决这个问题??????????????看起来 trac 没有看到 svn 存储库,或者可能存在一些权限问题。请帮帮我!

    <VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

<Location /svn>
    DAV svn
    SVNParentPath /var/svn
    SVNAutoversioning on
    AuthType Basic
    AuthName "Subversion Repository"
    AuthUserFile /etc/apache2/svn.passwd
    Require valid-user
</Location>

<Location /trac>
    SetHandler mod_python
    PythonInterpreter main_interpreter
    PythonHandler trac.web.modpython_frontend
    PythonOption PYTHON_EGG_CACHE /tmp/python_egg_cache
    PythonOption TracEnvParentDir /var/trac
    AuthType Basic
    AuthName "Trac"
    AuthUserFile /etc/apache2/svn.passwd
    Require valid-user
</Location>

Alias /trac/ /usr/share/trac/htdocs/

<Directory "/usr/share/trac/htdocs">
     Order allow,deny
     Allow from all
</Directory>

</VirtualHost>

Trac 配置:

    # -*- coding: utf-8 -*-

[attachment]
max_size = 262144
max_zip_size = 2097152
render_unsafe_content = disabled

[browser]
color_scale = enabled
downloadable_paths = /trunk,/branches/*,/tags/*,/*
hide_properties = svk:merge
intermediate_color = 
intermediate_point = 
newest_color = (255, 136, 136)
oldest_color = (136, 136, 255)
oneliner_properties = trac:summary
render_unsafe_content = disabled
wiki_properties = trac:description

[changeset]
max_diff_bytes = 10000000
max_diff_files = 0
wiki_format_messages = enabled

[header_logo]
alt = iec61850
height = -1
src = /var/trac/logo.png
width = -1

[inherit]
htdocs_dir = 
plugins_dir = 
templates_dir = 

[logging]
log_file = trac.log
log_format = 
log_level = DEBUG
log_type = file

[mainnav]
admin.order = 8.0
browser.order = 4.0
newticket.order = 6.0
roadmap.order = 3.0
search.order = 7.0
tickets.order = 5.0
timeline.order = 2.0
wiki.order = 1.0

[metanav]
about.order = 5.0
help.order = 4.0
login.order = 1.0
logout.order = 2.0
prefs.order = 3.0

[milestone]
default_group_by = component
default_retarget_to = 
stats_provider = DefaultTicketGroupStatsProvider

[mimeviewer]
max_preview_size = 262144
mime_map = text/x-dylan:dylan,text/x-idl:ice,text/x-ada:ads:adb
mime_map_patterns = text/plain:README(?!\.rst)|INSTALL(?!\.rst)|COPYING.*
pygments_default_style = trac
pygments_modes = 
tab_width = 8
treat_as_binary = application/octet-stream,application/pdf,application/postscript,application/msword,application/rtf

[notification]
admit_domains = 
ambiguous_char_width = single
batch_subject_template = $prefix Batch modify: $tickets_descr
email_address_resolvers = SessionEmailResolver
email_sender = SmtpEmailSender
ignore_domains = 
message_id_hash = md5
mime_encoding = none
sendmail_path = sendmail
smtp_always_bcc = 
smtp_always_cc = 
smtp_default_domain = 
smtp_enabled = disabled
smtp_from = trac@localhost
smtp_from_author = disabled
smtp_from_name = 
smtp_password = 
smtp_port = 25
smtp_replyto = trac@localhost
smtp_server = localhost
smtp_subject_prefix = __default__
smtp_user = 
ticket_subject_template = $prefix #$ticket.id: $summary
use_public_cc = disabled
use_short_addr = disabled
use_tls = disabled

[notification-subscriber]
always_notify_cc = CarbonCopySubscriber
always_notify_previous_updater = TicketPreviousUpdatersSubscriber
always_notify_updater = TicketUpdaterSubscriber

[project]
admin = 
admin_trac_url = .
descr = My example project
footer = Visit the Trac open source project at<br /><a href="http://trac.edgewall.org/">http://trac.edgewall.org/</a>
icon = common/trac.ico
name = iec61850
url = 

[query]
default_anonymous_query = status!=closed&cc~=$USER
default_query = status!=closed&owner=$USER
items_per_page = 100
ticketlink_query = ?status=!closed

[report]
items_per_page = 100
items_per_page_rss = 0

[repositories]
.alias = project
project.description = This is the ''main'' project repository.
project.dir = /var/svn/iec61850
project.hidden = false
project.type = svn
project.url = http://192.168.1.54/svn/iec61850

[revisionlog]
default_log_limit = 100
graph_colors = #cc0,#0c0,#0cc,#00c,#c0c,#c00

[roadmap]
stats_provider = DefaultTicketGroupStatsProvider

[search]
default_disabled_filters = 
min_query_length = 3

[sqlite]
extensions = 

[svn]
authz_file = /etc/apache2/svn.passwd
authz_module_name = 

[ticket]
allowed_empty_fields = milestone,version
default_cc = 
default_component = 
default_description = 
default_keywords = 
default_milestone = 
default_owner = < default >
default_priority = major
default_resolution = fixed
default_severity = 
default_summary = 
default_type = defect
default_version = 
max_comment_size = 262144
max_description_size = 262144
max_summary_size = 262144
preserve_newlines = default
restrict_owner = disabled
workflow = ConfigurableTicketWorkflow

[ticket-workflow]
accept = new,assigned,accepted,reopened -> accepted
accept.operations = set_owner_to_self
accept.permissions = TICKET_MODIFY
create = <none> -> new
create.default = 1
create_and_assign = <none> -> assigned
create_and_assign.label = assign
create_and_assign.operations = may_set_owner
create_and_assign.permissions = TICKET_MODIFY
leave = * -> *
leave.default = 1
leave.operations = leave_status
reassign = new,assigned,accepted,reopened -> assigned
reassign.operations = set_owner
reassign.permissions = TICKET_MODIFY
reopen = closed -> reopened
reopen.operations = del_resolution
reopen.permissions = TICKET_CREATE
resolve = new,assigned,accepted,reopened -> closed
resolve.operations = set_resolution
resolve.permissions = TICKET_MODIFY

[timeline]
abbreviated_messages = enabled
changeset_collapse_events = disabled
changeset_long_messages = disabled
changeset_show_files = 0
default_daysback = 30
max_daysback = 90
newticket_formatter = oneliner
ticket_show_component = disabled
ticket_show_details = disabled

[trac]
auth_cookie_domain = 
auth_cookie_lifetime = 0
auth_cookie_path = 
auto_preview_timeout = 2.0
auto_reload = disabled
backup_dir = db
base_url = 
check_auth_ip = disabled
database = sqlite:db/trac.db
debug_sql = disabled
default_charset = utf-8
default_date_format = 
default_dateinfo_format = relative
default_handler = WikiModule
default_language = 
default_timezone = 
genshi_cache_size = 128
htdocs_location = 
ignore_auth_case = disabled
jquery_location = 
jquery_ui_location = 
jquery_ui_theme_location = 
never_obfuscate_mailto = disabled
permission_policies = DefaultPermissionPolicy
permission_store = DefaultPermissionStore
repository_dir = /var/svn/iec61850
repository_sync_per_request = true
repository_type = svn
request_filters = 
resizable_textareas = enabled
secure_cookies = disabled
show_email_addresses = disabled
show_full_names = enabled
show_ip_addresses = disabled
timeout = 20
use_base_url_for_redirect = disabled
use_chunked_encoding = disabled
use_xsendfile = disabled
wiki_toolbars = enabled
xsendfile_header = X-Sendfile
mainnav = timeline,roadmap,browser,tickets,newticket,search
metanav = login,logout,settings,help,about

[versioncontrol]
allowed_repository_dir_prefixes = 
default_repository_type = svn

[wiki]
default_edit_area_height = 20
ignore_missing_pages = disabled
max_size = 262144
render_unsafe_content = disabled
safe_schemes = cvs,file,ftp,git,irc,http,https,news,sftp,smb,ssh,svn,svn+ssh
split_page_names = disabled

[components]
trac.versioncontrol.api.repositorymanager = enabled
trac.versioncontrol.svn_authz.svnauthzoptions = enabled
trac.versioncontrol.svn_fs.subversionconnector = enabled
trac.versioncontrol.svn_prop.subversionmergepropertydiffrenderer = enabled
trac.versioncontrol.svn_prop.subversionmergepropertyrenderer = enabled
trac.versioncontrol.svn_prop.subversionpropertyrenderer = enabled

它可以是任意数量的东西,但作为第一步,将 trac.ini 中的 [components] 部分替换为:

[components]
tracopt.versioncontrol.svn.* = enabled

如果这不能解决问题,请check the logs。启用 DEBUG 级别日志记录后,重新启动服务器并刷新页面。您应该在日志中找到类似以下的行:

13:40:52 Trac[loader] DEBUG: Loading plugin "tracopt.versioncontrol.svn.svn_fs" from "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git"
13:40:52 Trac[loader] DEBUG: Loading plugin "tracopt.versioncontrol.svn.svn_prop" from "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git"

或者,您可能会找到一个回溯,指出为什么 浏览器源代码 没有出现。

感谢您的回复!我能够解决这个问题。我将以下行添加到 trac.ini 中的 [components] 部分: tracopt.versioncontrol.svn.* = enabled tracopt.versioncontrol.git.* = 启用

我也做了 "trac-admin /var/trac/iec61850/ repository resync "*"" 并将此命令添加到 post-hook svn 脚本中。